初始化PHP-Xlswrite扩展
This commit is contained in:
343
kernel/chart.c
Normal file
343
kernel/chart.c
Normal file
@ -0,0 +1,343 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| XlsWriter Extension |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 2017-2018 The Viest |
|
||||
+----------------------------------------------------------------------+
|
||||
| http://www.viest.me |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: viest <dev@service.viest.me> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "xlswriter.h"
|
||||
|
||||
zend_class_entry *vtiful_chart_ce;
|
||||
|
||||
/* {{{ format_objects_new
|
||||
*/
|
||||
static zend_object_handlers chart_handlers;
|
||||
|
||||
static zend_always_inline void *vtiful_char_object_alloc(size_t obj_size, zend_class_entry *ce) {
|
||||
void *obj = emalloc(obj_size);
|
||||
memset(obj, 0, obj_size);
|
||||
return obj;
|
||||
}
|
||||
|
||||
PHP_VTIFUL_API zend_object *chart_objects_new(zend_class_entry *ce)
|
||||
{
|
||||
chart_object *format = (chart_object *)vtiful_char_object_alloc(sizeof(chart_object), ce);
|
||||
|
||||
zend_object_std_init(&format->zo, ce);
|
||||
object_properties_init(&format->zo, ce);
|
||||
|
||||
format->ptr.chart = NULL;
|
||||
format->ptr.series = NULL;
|
||||
format->zo.handlers = &chart_handlers;
|
||||
|
||||
return &format->zo;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ chart_objects_free
|
||||
*/
|
||||
static void chart_objects_free(zend_object *object)
|
||||
{
|
||||
chart_object *intern = php_vtiful_chart_fetch_object(object);
|
||||
|
||||
if (intern->ptr.series != NULL) {
|
||||
// free by workbook
|
||||
intern->ptr.series = NULL;
|
||||
}
|
||||
|
||||
if (intern->ptr.chart != NULL) {
|
||||
// free by workbook
|
||||
intern->ptr.chart = NULL;
|
||||
}
|
||||
|
||||
zend_object_std_dtor(&intern->zo);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ ARG_INFO
|
||||
*/
|
||||
ZEND_BEGIN_ARG_INFO_EX(chart_construct_arginfo, 0, 0, 2)
|
||||
ZEND_ARG_INFO(0, handle)
|
||||
ZEND_ARG_INFO(0, type)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(chart_series_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, value)
|
||||
ZEND_ARG_INFO(0, categories)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(chart_series_name_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, value)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(chart_style_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, style)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(chart_axis_name_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, name)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(chart_title_name_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, title)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(chart_legend_set_position_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, type)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(chart_to_resource_arginfo, 0, 0, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Chart::__construct(resource $handle, int $type)
|
||||
*/
|
||||
PHP_METHOD(vtiful_chart, __construct)
|
||||
{
|
||||
zval *handle;
|
||||
chart_object *obj;
|
||||
zend_long type = 0;
|
||||
xls_resource_write_t *xls_res;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(2, 2)
|
||||
Z_PARAM_RESOURCE(handle)
|
||||
Z_PARAM_LONG(type)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
xls_res = zval_get_resource(handle);
|
||||
obj = Z_CHART_P(getThis());
|
||||
|
||||
if (obj->ptr.chart == NULL) {
|
||||
obj->ptr.chart = workbook_add_chart(xls_res->workbook, (uint8_t)type);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Chart::series(string $value, string $categories)
|
||||
*/
|
||||
PHP_METHOD(vtiful_chart, series)
|
||||
{
|
||||
chart_object *obj;
|
||||
zend_string *values, *categories = NULL;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 2)
|
||||
Z_PARAM_STR(values)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_STR(categories)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
obj = Z_CHART_P(getThis());
|
||||
|
||||
if (ZEND_NUM_ARGS() == 2) {
|
||||
obj->ptr.series = chart_add_series(obj->ptr.chart, ZSTR_VAL(categories), ZSTR_VAL(values));
|
||||
}
|
||||
|
||||
if (ZEND_NUM_ARGS() == 1) {
|
||||
obj->ptr.series = chart_add_series(obj->ptr.chart, NULL, ZSTR_VAL(values));
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Chart::seriesName(string $value)
|
||||
*/
|
||||
PHP_METHOD(vtiful_chart, seriesName)
|
||||
{
|
||||
chart_object *obj;
|
||||
zend_string *values;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_STR(values)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
obj = Z_CHART_P(getThis());
|
||||
|
||||
chart_series_set_name(obj->ptr.series, ZSTR_VAL(values));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Chart::style(int $style)
|
||||
*/
|
||||
PHP_METHOD(vtiful_chart, style)
|
||||
{
|
||||
chart_object *obj;
|
||||
zend_long style = 0;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_LONG(style)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
obj = Z_CHART_P(getThis());
|
||||
|
||||
chart_set_style(obj->ptr.chart, (uint8_t)style);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Chart::axisNameX(string $name)
|
||||
*/
|
||||
PHP_METHOD(vtiful_chart, axisNameX)
|
||||
{
|
||||
chart_object *obj;
|
||||
zend_string *name;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_STR(name)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
obj = Z_CHART_P(getThis());
|
||||
|
||||
chart_axis_set_name(obj->ptr.chart->x_axis, ZSTR_VAL(name));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Chart::axisNameY(string $name)
|
||||
*/
|
||||
PHP_METHOD(vtiful_chart, axisNameY)
|
||||
{
|
||||
chart_object *obj;
|
||||
zend_string *name;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_STR(name)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
obj = Z_CHART_P(getThis());
|
||||
|
||||
chart_axis_set_name(obj->ptr.chart->y_axis, ZSTR_VAL(name));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Chart::title(string $title)
|
||||
*/
|
||||
PHP_METHOD(vtiful_chart, title)
|
||||
{
|
||||
chart_object *obj;
|
||||
zend_string *title;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_STR(title)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
obj = Z_CHART_P(getThis());
|
||||
|
||||
chart_title_set_name(obj->ptr.chart, ZSTR_VAL(title));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Chart::legendSetPosition(int $type)
|
||||
*/
|
||||
PHP_METHOD(vtiful_chart, legendSetPosition)
|
||||
{
|
||||
zend_long type = 0;
|
||||
chart_object *obj;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_LONG(type)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
obj = Z_CHART_P(getThis());
|
||||
|
||||
chart_legend_set_position(obj->ptr.chart, (uint8_t)type);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Chart::toResource()
|
||||
*/
|
||||
PHP_METHOD(vtiful_chart, toResource)
|
||||
{
|
||||
chart_object *obj = Z_CHART_P(getThis());
|
||||
|
||||
RETURN_RES(zend_register_resource(&obj->ptr, le_xls_writer));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ chart_methods
|
||||
*/
|
||||
zend_function_entry chart_methods[] = {
|
||||
PHP_ME(vtiful_chart, __construct, chart_construct_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_chart, series, chart_series_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_chart, seriesName, chart_series_name_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_chart, style, chart_style_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_chart, axisNameY, chart_axis_name_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_chart, axisNameX, chart_axis_name_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_chart, title, chart_title_name_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_chart, legendSetPosition, chart_legend_set_position_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_chart, toResource, chart_to_resource_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_FE_END
|
||||
};
|
||||
/* }}} */
|
||||
|
||||
/* {{{ */
|
||||
VTIFUL_STARTUP_FUNCTION(chart)
|
||||
{
|
||||
zend_class_entry ce;
|
||||
|
||||
INIT_NS_CLASS_ENTRY(ce, "Vtiful\\Kernel", "Chart", chart_methods);
|
||||
ce.create_object = chart_objects_new;
|
||||
vtiful_chart_ce = zend_register_internal_class(&ce);
|
||||
|
||||
memcpy(&chart_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
|
||||
chart_handlers.offset = XtOffsetOf(chart_object, zo);
|
||||
chart_handlers.free_obj = chart_objects_free;
|
||||
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_BAR", LXW_CHART_BAR)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_BAR_STACKED", LXW_CHART_BAR_STACKED)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_BAR_STACKED_PERCENT", LXW_CHART_BAR_STACKED_PERCENT)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_AREA", LXW_CHART_AREA)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_AREA_STACKED", LXW_CHART_AREA_STACKED)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_AREA_STACKED_PERCENT", LXW_CHART_AREA_STACKED_PERCENT)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_LINE", LXW_CHART_LINE)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_COLUMN", LXW_CHART_COLUMN)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_COLUMN_STACKED", LXW_CHART_COLUMN_STACKED)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_COLUMN_STACKED_PERCENT", LXW_CHART_COLUMN_STACKED_PERCENT)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_DOUGHNUT", LXW_CHART_DOUGHNUT)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_PIE", LXW_CHART_PIE)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_SCATTER", LXW_CHART_SCATTER)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_SCATTER_STRAIGHT", LXW_CHART_SCATTER_STRAIGHT)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_SCATTER_STRAIGHT_WITH_MARKERS", LXW_CHART_SCATTER_STRAIGHT_WITH_MARKERS)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_SCATTER_SMOOTH", LXW_CHART_SCATTER_SMOOTH)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_SCATTER_SMOOTH_WITH_MARKERS", LXW_CHART_SCATTER_SMOOTH_WITH_MARKERS)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_RADAR", LXW_CHART_RADAR)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_RADAR_WITH_MARKERS", LXW_CHART_RADAR_WITH_MARKERS)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_RADAR_FILLED", LXW_CHART_RADAR_FILLED)
|
||||
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_LEGEND_NONE", LXW_CHART_LEGEND_NONE)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_LEGEND_RIGHT", LXW_CHART_LEGEND_RIGHT)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_LEGEND_LEFT", LXW_CHART_LEGEND_LEFT)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_LEGEND_TOP", LXW_CHART_LEGEND_TOP)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_LEGEND_BOTTOM", LXW_CHART_LEGEND_BOTTOM)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_LEGEND_OVERLAY_RIGHT", LXW_CHART_LEGEND_OVERLAY_RIGHT)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_LEGEND_OVERLAY_LEFT", LXW_CHART_LEGEND_OVERLAY_LEFT)
|
||||
|
||||
#if defined(LXW_VERSION_ID) && LXW_VERSION_ID >= 95
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_LINE_STACKED", LXW_CHART_LINE_STACKED)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_LINE_STACKED_PERCENT", LXW_CHART_LINE_STACKED_PERCENT)
|
||||
#endif
|
||||
|
||||
// PECL Windows version is 0.7.7, but define in 0.7.8
|
||||
//REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_LEGEND_TOP_RIGHT", LXW_CHART_LEGEND_TOP_RIGHT)
|
||||
//REGISTER_CLASS_CONST_LONG(vtiful_chart_ce, "CHART_LEGEND_OVERLAY_TOP_RIGHT", LXW_CHART_LEGEND_OVERLAY_TOP_RIGHT)
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
121
kernel/chart.dep
Normal file
121
kernel/chart.dep
Normal file
@ -0,0 +1,121 @@
|
||||
kernel/chart.lo: \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/kernel/chart.c \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/xlswriter.h \
|
||||
config.h /usr/local/etc/php/include/php/main/php.h \
|
||||
/usr/local/etc/php/include/php/main/php_version.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_types.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_portability.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_config.h \
|
||||
/usr/local/etc/php/include/php/main/../main/php_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/../TSRM/TSRM.h \
|
||||
/usr/local/etc/php/include/php/main/php_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_range_check.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_long.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_map_ptr.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_errors.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_alloc.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_alloc_sizes.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_llist.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_string.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_hash.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_sort.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ast.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_gc.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_hrtime.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_variables.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_iterators.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_stream.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_str_public.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_string_public.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_signal.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_max_execution_timer.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_object_handlers.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_operators.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_strtod.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_multiply.h \
|
||||
/usr/local/etc/php/include/php/main/php_compat.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_API.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_modules.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_compile.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_globals.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_globals_macros.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_atomic.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ptr_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_objects.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_objects_API.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_float.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_multibyte.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_arena.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_call_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_vm_opcodes.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_build.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_list.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_execute.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_type_info.h \
|
||||
/usr/local/etc/php/include/php/main/build-defs.h \
|
||||
/usr/local/etc/php/include/php/main/snprintf.h \
|
||||
/usr/local/etc/php/include/php/main/spprintf.h \
|
||||
/usr/local/etc/php/include/php/main/php_syslog.h \
|
||||
/usr/local/etc/php/include/php/main/php_output.h \
|
||||
/usr/local/etc/php/include/php/main/php_streams.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_context.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_filter_api.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_transport.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_plain_wrapper.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_glob_wrapper.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_userspace.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_mmap.h \
|
||||
/usr/local/etc/php/include/php/main/php_memory_streams.h \
|
||||
/usr/local/etc/php/include/php/main/fopen_wrappers.h \
|
||||
/usr/local/etc/php/include/php/main/php_globals.h \
|
||||
/usr/local/etc/php/include/php/main/php_ini.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ini.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_virtual_cwd.h \
|
||||
/usr/local/etc/php/include/php/TSRM/TSRM.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_constants.h \
|
||||
/usr/local/etc/php/include/php/main/php_reentrancy.h \
|
||||
/usr/local/etc/php/include/php/ext/date/php_date.h \
|
||||
/usr/local/etc/php/include/php/ext/date/lib/timelib.h \
|
||||
/usr/local/etc/php/include/php/ext/date/lib/timelib_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_str.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_exceptions.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/workbook.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/worksheet.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/shared_strings.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/common.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/queue.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/tree.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/chart.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/format.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/hash_table.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/drawing.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/styles.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/utility.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/xmlwriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/relationships.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/chartsheet.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/packager.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/zip.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/app.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/core.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/custom.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/theme.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/content_types.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/vml.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/comment.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/metadata.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/common.h \
|
||||
php_xlswriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/excel.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/validation.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/exception.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/format.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/chart.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/rich_string.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/help.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxio/include/xlsxio_read.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/read.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/csv.h
|
105
kernel/common.c
Normal file
105
kernel/common.c
Normal file
@ -0,0 +1,105 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| XlsWriter Extension |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 2017-2018 The Viest |
|
||||
+----------------------------------------------------------------------+
|
||||
| http://www.viest.me |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: viest <dev@service.viest.me> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "xlswriter.h"
|
||||
|
||||
/* {{{ */
|
||||
void xls_file_path(zend_string *file_name, zval *dir_path, zval *file_path)
|
||||
{
|
||||
zend_string *full_path, *zstr_path;
|
||||
|
||||
zstr_path = zval_get_string(dir_path);
|
||||
|
||||
if (Z_STRVAL_P(dir_path)[Z_STRLEN_P(dir_path)-1] == '/') {
|
||||
full_path = zend_string_extend(zstr_path, ZSTR_LEN(zstr_path) + ZSTR_LEN(file_name), 0);
|
||||
memcpy(ZSTR_VAL(full_path)+ZSTR_LEN(zstr_path), ZSTR_VAL(file_name), ZSTR_LEN(file_name)+1);
|
||||
} else {
|
||||
full_path = zend_string_extend(zstr_path, ZSTR_LEN(zstr_path) + ZSTR_LEN(file_name) + 1, 0);
|
||||
ZSTR_VAL(full_path)[ZSTR_LEN(zstr_path)] ='/';
|
||||
memcpy(ZSTR_VAL(full_path)+ZSTR_LEN(zstr_path)+1, ZSTR_VAL(file_name), ZSTR_LEN(file_name)+1);
|
||||
}
|
||||
|
||||
ZVAL_STR(file_path, full_path);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ */
|
||||
zend_string* str_pick_up(zend_string *left, const char *right, size_t len)
|
||||
{
|
||||
zend_string *full = NULL;
|
||||
|
||||
size_t _left_length = ZSTR_LEN(left);
|
||||
size_t _extend_length = _left_length + len;
|
||||
|
||||
full = zend_string_extend(left, _extend_length, 0);
|
||||
|
||||
memcpy(ZSTR_VAL(full) + _left_length, right, len);
|
||||
|
||||
ZSTR_VAL(full)[_extend_length] = '\0';
|
||||
|
||||
return full;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ */
|
||||
zend_string* char_join_to_zend_str(const char *left, const char *right)
|
||||
{
|
||||
size_t _new_len = strlen(left) + strlen(right);
|
||||
|
||||
zend_string *str = zend_string_alloc(_new_len, 0);
|
||||
|
||||
memcpy(ZSTR_VAL(str), left, strlen(left));
|
||||
memcpy(ZSTR_VAL(str) + strlen(left), right, strlen(right) + 1);
|
||||
|
||||
ZSTR_VAL(str)[_new_len] = '\0';
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* {{{ */
|
||||
void call_object_method(zval *object, const char *function_name, uint32_t param_count, zval *params, zval *ret_val)
|
||||
{
|
||||
uint32_t index;
|
||||
zval z_f_name;
|
||||
|
||||
ZVAL_STRINGL(&z_f_name, function_name, strlen(function_name));
|
||||
call_user_function(NULL, object, &z_f_name, ret_val, param_count, params);
|
||||
|
||||
if (Z_ISUNDEF_P(ret_val)) {
|
||||
ZVAL_NULL(ret_val);
|
||||
}
|
||||
|
||||
for (index = 0; index < param_count; index++) {
|
||||
zval_ptr_dtor(¶ms[index]);
|
||||
}
|
||||
|
||||
zval_ptr_dtor(&z_f_name);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
lxw_datetime timestamp_to_datetime(zend_long timestamp)
|
||||
{
|
||||
int yearLocal = php_idate('Y', timestamp, 0);
|
||||
int monthLocal = php_idate('m', timestamp, 0);
|
||||
int dayLocal = php_idate('d', timestamp, 0);
|
||||
int hourLocal = php_idate('H', timestamp, 0);
|
||||
int minuteLocal = php_idate('i', timestamp, 0);
|
||||
int secondLocal = php_idate('s', timestamp, 0);
|
||||
|
||||
lxw_datetime datetime = {
|
||||
yearLocal, monthLocal, dayLocal, hourLocal, minuteLocal, secondLocal
|
||||
};
|
||||
|
||||
return datetime;
|
||||
}
|
121
kernel/common.dep
Normal file
121
kernel/common.dep
Normal file
@ -0,0 +1,121 @@
|
||||
kernel/common.lo: \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/kernel/common.c \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/xlswriter.h \
|
||||
config.h /usr/local/etc/php/include/php/main/php.h \
|
||||
/usr/local/etc/php/include/php/main/php_version.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_types.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_portability.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_config.h \
|
||||
/usr/local/etc/php/include/php/main/../main/php_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/../TSRM/TSRM.h \
|
||||
/usr/local/etc/php/include/php/main/php_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_range_check.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_long.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_map_ptr.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_errors.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_alloc.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_alloc_sizes.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_llist.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_string.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_hash.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_sort.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ast.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_gc.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_hrtime.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_variables.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_iterators.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_stream.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_str_public.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_string_public.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_signal.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_max_execution_timer.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_object_handlers.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_operators.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_strtod.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_multiply.h \
|
||||
/usr/local/etc/php/include/php/main/php_compat.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_API.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_modules.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_compile.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_globals.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_globals_macros.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_atomic.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ptr_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_objects.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_objects_API.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_float.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_multibyte.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_arena.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_call_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_vm_opcodes.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_build.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_list.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_execute.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_type_info.h \
|
||||
/usr/local/etc/php/include/php/main/build-defs.h \
|
||||
/usr/local/etc/php/include/php/main/snprintf.h \
|
||||
/usr/local/etc/php/include/php/main/spprintf.h \
|
||||
/usr/local/etc/php/include/php/main/php_syslog.h \
|
||||
/usr/local/etc/php/include/php/main/php_output.h \
|
||||
/usr/local/etc/php/include/php/main/php_streams.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_context.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_filter_api.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_transport.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_plain_wrapper.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_glob_wrapper.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_userspace.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_mmap.h \
|
||||
/usr/local/etc/php/include/php/main/php_memory_streams.h \
|
||||
/usr/local/etc/php/include/php/main/fopen_wrappers.h \
|
||||
/usr/local/etc/php/include/php/main/php_globals.h \
|
||||
/usr/local/etc/php/include/php/main/php_ini.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ini.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_virtual_cwd.h \
|
||||
/usr/local/etc/php/include/php/TSRM/TSRM.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_constants.h \
|
||||
/usr/local/etc/php/include/php/main/php_reentrancy.h \
|
||||
/usr/local/etc/php/include/php/ext/date/php_date.h \
|
||||
/usr/local/etc/php/include/php/ext/date/lib/timelib.h \
|
||||
/usr/local/etc/php/include/php/ext/date/lib/timelib_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_str.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_exceptions.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/workbook.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/worksheet.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/shared_strings.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/common.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/queue.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/tree.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/chart.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/format.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/hash_table.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/drawing.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/styles.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/utility.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/xmlwriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/relationships.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/chartsheet.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/packager.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/zip.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/app.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/core.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/custom.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/theme.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/content_types.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/vml.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/comment.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/metadata.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/common.h \
|
||||
php_xlswriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/excel.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/validation.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/exception.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/format.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/chart.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/rich_string.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/help.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxio/include/xlsxio_read.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/read.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/csv.h
|
127
kernel/csv.c
Normal file
127
kernel/csv.c
Normal file
@ -0,0 +1,127 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| XlsWriter Extension |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 2017-2018 The Viest |
|
||||
+----------------------------------------------------------------------+
|
||||
| http://www.viest.me |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: viest <dev@service.viest.me> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "xlswriter.h"
|
||||
#include "php_streams.h"
|
||||
#include "ext/standard/file.h"
|
||||
|
||||
/* {{{ */
|
||||
unsigned int xlsx_to_csv(
|
||||
zval *stream_resource,
|
||||
const char *delimiter_str, int delimiter_str_len,
|
||||
const char *enclosure_str, int enclosure_str_len,
|
||||
const char *escape_str, int escape_str_len,
|
||||
xlsxioreadersheet sheet_t,
|
||||
zval *zv_type_arr_t, zend_long data_type_default,
|
||||
unsigned int flag, zend_fcall_info *fci, zend_fcall_info_cache *fci_cache
|
||||
)
|
||||
{
|
||||
ssize_t ret = 0;
|
||||
zval *_zv_type_arr_t = NULL;
|
||||
php_stream *_stream_t = NULL;
|
||||
char delimiter = ',', enclosure = '"', escape_char = '\\';
|
||||
|
||||
ZEND_ASSERT(Z_TYPE_P(stream_resource) == IS_RESOURCE);
|
||||
|
||||
if (((_stream_t) = (php_stream *)zend_fetch_resource2((Z_RES_P(stream_resource)),
|
||||
"stream", php_file_le_stream(), php_file_le_pstream())) == NULL) {
|
||||
return XLSWRITER_FALSE;
|
||||
}
|
||||
|
||||
if (delimiter_str != NULL) {
|
||||
if (delimiter_str_len < 1) {
|
||||
zend_throw_exception(vtiful_exception_ce, "delimiter must be a character", 190);
|
||||
return XLSWRITER_FALSE;
|
||||
} else if (delimiter_str_len > 1) {
|
||||
zend_throw_exception(vtiful_exception_ce, "delimiter must be a single character", 191);
|
||||
return XLSWRITER_FALSE;
|
||||
}
|
||||
|
||||
delimiter = *delimiter_str;
|
||||
}
|
||||
|
||||
if (enclosure_str != NULL) {
|
||||
if (enclosure_str_len < 1) {
|
||||
zend_throw_exception(vtiful_exception_ce, "enclosure must be a character", 192);
|
||||
return XLSWRITER_FALSE;
|
||||
} else if (enclosure_str_len > 1) {
|
||||
zend_throw_exception(vtiful_exception_ce, "enclosure must be a single character", 193);
|
||||
return XLSWRITER_FALSE;
|
||||
}
|
||||
|
||||
enclosure = *enclosure_str;
|
||||
}
|
||||
|
||||
if (escape_str != NULL) {
|
||||
if (escape_str_len < 1) {
|
||||
zend_throw_exception(vtiful_exception_ce, "escape must be a character", 194);
|
||||
return XLSWRITER_FALSE;
|
||||
} else if (escape_str_len > 1) {
|
||||
zend_throw_exception(vtiful_exception_ce, "escape must be a single character", 195);
|
||||
return XLSWRITER_FALSE;
|
||||
}
|
||||
|
||||
escape_char = *escape_str;
|
||||
}
|
||||
|
||||
if (Z_TYPE_P(zv_type_arr_t) == IS_ARRAY) {
|
||||
_zv_type_arr_t = zv_type_arr_t;
|
||||
}
|
||||
|
||||
zval _zv_tmp_row;
|
||||
ZVAL_NULL(&_zv_tmp_row);
|
||||
|
||||
while (sheet_read_row(sheet_t))
|
||||
{
|
||||
load_sheet_current_row_data(sheet_t, &_zv_tmp_row, _zv_type_arr_t, data_type_default, flag);
|
||||
|
||||
if (fci != NULL && fci_cache != NULL) {
|
||||
zval retval;
|
||||
|
||||
fci->retval = &retval;
|
||||
fci->params = &_zv_tmp_row;
|
||||
fci->param_count = 1;
|
||||
|
||||
zend_call_function(fci, fci_cache);
|
||||
|
||||
if (Z_TYPE(retval) == IS_ARRAY) {
|
||||
#if PHP_VERSION_ID >= 80100
|
||||
ret = php_fputcsv(_stream_t, &retval, delimiter, enclosure, escape_char, NULL);
|
||||
#else
|
||||
ret = php_fputcsv(_stream_t, &retval, delimiter, enclosure, escape_char);
|
||||
#endif
|
||||
}
|
||||
|
||||
zval_ptr_dtor(&retval);
|
||||
goto CLEAN_UP_SCENE;
|
||||
}
|
||||
|
||||
#if PHP_VERSION_ID >= 80100
|
||||
ret = php_fputcsv(_stream_t, &_zv_tmp_row, delimiter, enclosure, escape_char, NULL);
|
||||
#else
|
||||
ret = php_fputcsv(_stream_t, &_zv_tmp_row, delimiter, enclosure, escape_char);
|
||||
#endif
|
||||
|
||||
CLEAN_UP_SCENE:
|
||||
|
||||
zend_hash_clean(Z_ARRVAL(_zv_tmp_row));
|
||||
|
||||
if (ret < 0) {
|
||||
return XLSWRITER_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
zval_dtor(&_zv_tmp_row);
|
||||
|
||||
return XLSWRITER_TRUE;
|
||||
}
|
||||
/* }}} */
|
123
kernel/csv.dep
Normal file
123
kernel/csv.dep
Normal file
@ -0,0 +1,123 @@
|
||||
kernel/csv.lo: \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/kernel/csv.c \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/xlswriter.h \
|
||||
config.h /usr/local/etc/php/include/php/main/php.h \
|
||||
/usr/local/etc/php/include/php/main/php_version.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_types.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_portability.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_config.h \
|
||||
/usr/local/etc/php/include/php/main/../main/php_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/../TSRM/TSRM.h \
|
||||
/usr/local/etc/php/include/php/main/php_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_range_check.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_long.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_map_ptr.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_errors.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_alloc.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_alloc_sizes.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_llist.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_string.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_hash.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_sort.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ast.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_gc.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_hrtime.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_variables.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_iterators.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_stream.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_str_public.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_string_public.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_signal.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_max_execution_timer.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_object_handlers.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_operators.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_strtod.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_multiply.h \
|
||||
/usr/local/etc/php/include/php/main/php_compat.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_API.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_modules.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_compile.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_globals.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_globals_macros.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_atomic.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ptr_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_objects.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_objects_API.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_float.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_multibyte.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_arena.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_call_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_vm_opcodes.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_build.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_list.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_execute.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_type_info.h \
|
||||
/usr/local/etc/php/include/php/main/build-defs.h \
|
||||
/usr/local/etc/php/include/php/main/snprintf.h \
|
||||
/usr/local/etc/php/include/php/main/spprintf.h \
|
||||
/usr/local/etc/php/include/php/main/php_syslog.h \
|
||||
/usr/local/etc/php/include/php/main/php_output.h \
|
||||
/usr/local/etc/php/include/php/main/php_streams.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_context.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_filter_api.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_transport.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_plain_wrapper.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_glob_wrapper.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_userspace.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_mmap.h \
|
||||
/usr/local/etc/php/include/php/main/php_memory_streams.h \
|
||||
/usr/local/etc/php/include/php/main/fopen_wrappers.h \
|
||||
/usr/local/etc/php/include/php/main/php_globals.h \
|
||||
/usr/local/etc/php/include/php/main/php_ini.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ini.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_virtual_cwd.h \
|
||||
/usr/local/etc/php/include/php/TSRM/TSRM.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_constants.h \
|
||||
/usr/local/etc/php/include/php/main/php_reentrancy.h \
|
||||
/usr/local/etc/php/include/php/ext/date/php_date.h \
|
||||
/usr/local/etc/php/include/php/ext/date/lib/timelib.h \
|
||||
/usr/local/etc/php/include/php/ext/date/lib/timelib_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_str.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_exceptions.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/workbook.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/worksheet.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/shared_strings.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/common.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/queue.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/tree.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/chart.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/format.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/hash_table.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/drawing.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/styles.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/utility.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/xmlwriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/relationships.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/chartsheet.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/packager.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/zip.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/app.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/core.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/custom.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/theme.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/content_types.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/vml.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/comment.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/metadata.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/common.h \
|
||||
php_xlswriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/excel.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/validation.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/exception.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/format.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/chart.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/rich_string.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/help.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxio/include/xlsxio_read.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/read.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/csv.h \
|
||||
/usr/local/etc/php/include/php/ext/standard/file.h \
|
||||
/usr/local/etc/php/include/php/main/php_network.h
|
1842
kernel/excel.c
Normal file
1842
kernel/excel.c
Normal file
File diff suppressed because it is too large
Load Diff
121
kernel/excel.dep
Normal file
121
kernel/excel.dep
Normal file
@ -0,0 +1,121 @@
|
||||
kernel/excel.lo: \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/kernel/excel.c \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/xlswriter.h \
|
||||
config.h /usr/local/etc/php/include/php/main/php.h \
|
||||
/usr/local/etc/php/include/php/main/php_version.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_types.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_portability.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_config.h \
|
||||
/usr/local/etc/php/include/php/main/../main/php_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/../TSRM/TSRM.h \
|
||||
/usr/local/etc/php/include/php/main/php_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_range_check.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_long.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_map_ptr.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_errors.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_alloc.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_alloc_sizes.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_llist.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_string.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_hash.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_sort.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ast.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_gc.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_hrtime.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_variables.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_iterators.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_stream.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_str_public.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_string_public.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_signal.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_max_execution_timer.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_object_handlers.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_operators.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_strtod.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_multiply.h \
|
||||
/usr/local/etc/php/include/php/main/php_compat.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_API.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_modules.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_compile.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_globals.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_globals_macros.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_atomic.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ptr_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_objects.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_objects_API.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_float.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_multibyte.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_arena.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_call_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_vm_opcodes.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_build.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_list.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_execute.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_type_info.h \
|
||||
/usr/local/etc/php/include/php/main/build-defs.h \
|
||||
/usr/local/etc/php/include/php/main/snprintf.h \
|
||||
/usr/local/etc/php/include/php/main/spprintf.h \
|
||||
/usr/local/etc/php/include/php/main/php_syslog.h \
|
||||
/usr/local/etc/php/include/php/main/php_output.h \
|
||||
/usr/local/etc/php/include/php/main/php_streams.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_context.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_filter_api.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_transport.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_plain_wrapper.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_glob_wrapper.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_userspace.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_mmap.h \
|
||||
/usr/local/etc/php/include/php/main/php_memory_streams.h \
|
||||
/usr/local/etc/php/include/php/main/fopen_wrappers.h \
|
||||
/usr/local/etc/php/include/php/main/php_globals.h \
|
||||
/usr/local/etc/php/include/php/main/php_ini.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ini.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_virtual_cwd.h \
|
||||
/usr/local/etc/php/include/php/TSRM/TSRM.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_constants.h \
|
||||
/usr/local/etc/php/include/php/main/php_reentrancy.h \
|
||||
/usr/local/etc/php/include/php/ext/date/php_date.h \
|
||||
/usr/local/etc/php/include/php/ext/date/lib/timelib.h \
|
||||
/usr/local/etc/php/include/php/ext/date/lib/timelib_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_str.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_exceptions.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/workbook.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/worksheet.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/shared_strings.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/common.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/queue.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/tree.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/chart.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/format.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/hash_table.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/drawing.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/styles.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/utility.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/xmlwriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/relationships.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/chartsheet.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/packager.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/zip.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/app.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/core.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/custom.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/theme.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/content_types.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/vml.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/comment.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/metadata.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/common.h \
|
||||
php_xlswriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/excel.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/validation.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/exception.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/format.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/chart.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/rich_string.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/help.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxio/include/xlsxio_read.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/read.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/csv.h
|
85
kernel/exception.c
Normal file
85
kernel/exception.c
Normal file
@ -0,0 +1,85 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| XlsWriter Extension |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 2017-2018 The Viest |
|
||||
+----------------------------------------------------------------------+
|
||||
| http://www.viest.me |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: viest <dev@service.viest.me> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "xlswriter.h"
|
||||
|
||||
zend_class_entry *vtiful_exception_ce;
|
||||
|
||||
/** {{{ exception_methods
|
||||
*/
|
||||
zend_function_entry exception_methods[] = {
|
||||
PHP_FE_END
|
||||
};
|
||||
/* }}} */
|
||||
|
||||
/** {{{ VTIFUL_STARTUP_FUNCTION
|
||||
*/
|
||||
VTIFUL_STARTUP_FUNCTION(exception) {
|
||||
zend_class_entry ce;
|
||||
|
||||
INIT_NS_CLASS_ENTRY(ce, "Vtiful\\Kernel", "Exception", exception_methods);
|
||||
|
||||
vtiful_exception_ce = zend_register_internal_class_ex(&ce, zend_ce_exception);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ exception_message_map
|
||||
*/
|
||||
char* exception_message_map(int code) {
|
||||
switch (code) {
|
||||
case LXW_ERROR_MEMORY_MALLOC_FAILED:
|
||||
return "Memory error, failed to malloc() required memory.";
|
||||
case LXW_ERROR_CREATING_XLSX_FILE:
|
||||
return "Error creating output xlsx file. Usually a permissions error.";
|
||||
case LXW_ERROR_CREATING_TMPFILE:
|
||||
return "Error encountered when creating a tmpfile during file assembly.";
|
||||
case LXW_ERROR_READING_TMPFILE:
|
||||
return "Error reading a tmpfile.";
|
||||
case LXW_ERROR_ZIP_FILE_OPERATION:
|
||||
return "Zlib error with a file operation while creating xlsx file.";
|
||||
case LXW_ERROR_ZIP_FILE_ADD:
|
||||
return "Zlib error when adding sub file to xlsx file.";
|
||||
case LXW_ERROR_ZIP_CLOSE:
|
||||
return "Zlib error when closing xlsx file.";
|
||||
case LXW_ERROR_NULL_PARAMETER_IGNORED:
|
||||
return "NULL function parameter ignored.";
|
||||
case LXW_ERROR_PARAMETER_VALIDATION:
|
||||
return "Function parameter validation error.";
|
||||
case LXW_ERROR_SHEETNAME_LENGTH_EXCEEDED:
|
||||
return "Worksheet name exceeds Excel's limit of 31 characters.";
|
||||
case LXW_ERROR_INVALID_SHEETNAME_CHARACTER:
|
||||
return "Worksheet name contains invalid.";
|
||||
case LXW_ERROR_SHEETNAME_ALREADY_USED:
|
||||
return "Worksheet name is already in use.";
|
||||
case LXW_ERROR_32_STRING_LENGTH_EXCEEDED:
|
||||
return "Parameter exceeds Excel's limit of 32 characters.";
|
||||
case LXW_ERROR_128_STRING_LENGTH_EXCEEDED:
|
||||
return "Parameter exceeds Excel's limit of 128 characters.";
|
||||
case LXW_ERROR_255_STRING_LENGTH_EXCEEDED:
|
||||
return "Parameter exceeds Excel's limit of 255 characters.";
|
||||
case LXW_ERROR_MAX_STRING_LENGTH_EXCEEDED:
|
||||
return "String exceeds Excel's limit of 32:767 characters.";
|
||||
case LXW_ERROR_SHARED_STRING_INDEX_NOT_FOUND:
|
||||
return "Error finding internal string index.";
|
||||
case LXW_ERROR_WORKSHEET_INDEX_OUT_OF_RANGE:
|
||||
return "Worksheet row or column index out of range.";
|
||||
case LXW_ERROR_WORKSHEET_MAX_NUMBER_URLS_EXCEEDED:
|
||||
return "Maximum number of worksheet URLs (65530) exceeded.";
|
||||
case LXW_ERROR_IMAGE_DIMENSIONS:
|
||||
return "Couldn't read image dimensions or DPI.";
|
||||
default:
|
||||
return "Unknown error";
|
||||
}
|
||||
}
|
||||
/* }}} */
|
121
kernel/exception.dep
Normal file
121
kernel/exception.dep
Normal file
@ -0,0 +1,121 @@
|
||||
kernel/exception.lo: \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/kernel/exception.c \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/xlswriter.h \
|
||||
config.h /usr/local/etc/php/include/php/main/php.h \
|
||||
/usr/local/etc/php/include/php/main/php_version.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_types.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_portability.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_config.h \
|
||||
/usr/local/etc/php/include/php/main/../main/php_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/../TSRM/TSRM.h \
|
||||
/usr/local/etc/php/include/php/main/php_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_range_check.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_long.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_map_ptr.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_errors.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_alloc.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_alloc_sizes.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_llist.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_string.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_hash.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_sort.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ast.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_gc.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_hrtime.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_variables.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_iterators.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_stream.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_str_public.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_string_public.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_signal.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_max_execution_timer.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_object_handlers.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_operators.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_strtod.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_multiply.h \
|
||||
/usr/local/etc/php/include/php/main/php_compat.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_API.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_modules.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_compile.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_globals.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_globals_macros.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_atomic.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ptr_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_objects.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_objects_API.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_float.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_multibyte.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_arena.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_call_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_vm_opcodes.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_build.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_list.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_execute.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_type_info.h \
|
||||
/usr/local/etc/php/include/php/main/build-defs.h \
|
||||
/usr/local/etc/php/include/php/main/snprintf.h \
|
||||
/usr/local/etc/php/include/php/main/spprintf.h \
|
||||
/usr/local/etc/php/include/php/main/php_syslog.h \
|
||||
/usr/local/etc/php/include/php/main/php_output.h \
|
||||
/usr/local/etc/php/include/php/main/php_streams.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_context.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_filter_api.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_transport.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_plain_wrapper.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_glob_wrapper.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_userspace.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_mmap.h \
|
||||
/usr/local/etc/php/include/php/main/php_memory_streams.h \
|
||||
/usr/local/etc/php/include/php/main/fopen_wrappers.h \
|
||||
/usr/local/etc/php/include/php/main/php_globals.h \
|
||||
/usr/local/etc/php/include/php/main/php_ini.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ini.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_virtual_cwd.h \
|
||||
/usr/local/etc/php/include/php/TSRM/TSRM.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_constants.h \
|
||||
/usr/local/etc/php/include/php/main/php_reentrancy.h \
|
||||
/usr/local/etc/php/include/php/ext/date/php_date.h \
|
||||
/usr/local/etc/php/include/php/ext/date/lib/timelib.h \
|
||||
/usr/local/etc/php/include/php/ext/date/lib/timelib_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_str.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_exceptions.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/workbook.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/worksheet.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/shared_strings.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/common.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/queue.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/tree.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/chart.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/format.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/hash_table.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/drawing.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/styles.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/utility.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/xmlwriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/relationships.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/chartsheet.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/packager.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/zip.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/app.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/core.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/custom.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/theme.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/content_types.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/vml.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/comment.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/metadata.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/common.h \
|
||||
php_xlswriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/excel.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/validation.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/exception.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/format.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/chart.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/rich_string.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/help.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxio/include/xlsxio_read.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/read.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/csv.h
|
602
kernel/format.c
Normal file
602
kernel/format.c
Normal file
@ -0,0 +1,602 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| XlsWriter Extension |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 2017-2018 The Viest |
|
||||
+----------------------------------------------------------------------+
|
||||
| http://www.viest.me |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: viest <dev@service.viest.me> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "xlswriter.h"
|
||||
|
||||
zend_class_entry *vtiful_format_ce;
|
||||
|
||||
/* {{{ format_objects_new
|
||||
*/
|
||||
static zend_object_handlers format_handlers;
|
||||
|
||||
static zend_always_inline void *vtiful_format_object_alloc(size_t obj_size, zend_class_entry *ce) {
|
||||
void *obj = emalloc(obj_size);
|
||||
memset(obj, 0, obj_size);
|
||||
return obj;
|
||||
}
|
||||
|
||||
PHP_VTIFUL_API zend_object *format_objects_new(zend_class_entry *ce)
|
||||
{
|
||||
format_object *format = vtiful_format_object_alloc(sizeof(format_object), ce);
|
||||
|
||||
zend_object_std_init(&format->zo, ce);
|
||||
object_properties_init(&format->zo, ce);
|
||||
|
||||
format->ptr.format = NULL;
|
||||
format->zo.handlers = &format_handlers;
|
||||
|
||||
return &format->zo;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ format_objects_free
|
||||
*/
|
||||
static void format_objects_free(zend_object *object)
|
||||
{
|
||||
format_object *intern = php_vtiful_format_fetch_object(object);
|
||||
|
||||
if (intern->ptr.format != NULL) {
|
||||
// free by workbook
|
||||
intern->ptr.format = NULL;
|
||||
}
|
||||
|
||||
zend_object_std_dtor(&intern->zo);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ ARG_INFO
|
||||
*/
|
||||
ZEND_BEGIN_ARG_INFO_EX(format_construct_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, handle)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(format_wrap_arginfo, 0, 0, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(format_bold_arginfo, 0, 0, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(format_italic_arginfo, 0, 0, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(format_underline_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, style)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(format_unlocked_arginfo, 0, 0, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(format_align_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_VARIADIC_INFO(0, style)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(format_color_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, color)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(format_size_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, size)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(format_strikeout_arginfo, 0, 0, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(format_number_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, format)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(format_background_arginfo, 0, 0, 2)
|
||||
ZEND_ARG_INFO(0, pattern)
|
||||
ZEND_ARG_INFO(0, color)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(format_border_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, style)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(format_border_of_the_four_sides_arginfo, 0, 0, 4)
|
||||
ZEND_ARG_INFO(0, top)
|
||||
ZEND_ARG_INFO(0, right)
|
||||
ZEND_ARG_INFO(0, bottom)
|
||||
ZEND_ARG_INFO(0, left)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(format_border_color_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, color)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(format_border_color_of_the_four_sides_arginfo, 0, 0, 4)
|
||||
ZEND_ARG_INFO(0, top_color)
|
||||
ZEND_ARG_INFO(0, right_color)
|
||||
ZEND_ARG_INFO(0, bottom_color)
|
||||
ZEND_ARG_INFO(0, left_color)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(format_font_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, font)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(format_to_resource_arginfo, 0, 0, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Format::__construct()
|
||||
*/
|
||||
PHP_METHOD(vtiful_format, __construct)
|
||||
{
|
||||
zval *handle;
|
||||
format_object *obj;
|
||||
xls_resource_write_t *xls_res;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_RESOURCE(handle)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
xls_res = zval_get_resource(handle);
|
||||
obj = Z_FORMAT_P(getThis());
|
||||
|
||||
if (obj->ptr.format == NULL) {
|
||||
obj->ptr.format = workbook_add_format(xls_res->workbook);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Format::bold()
|
||||
*/
|
||||
PHP_METHOD(vtiful_format, bold)
|
||||
{
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
format_object *obj = Z_FORMAT_P(getThis());
|
||||
|
||||
if (obj->ptr.format) {
|
||||
format_set_bold(obj->ptr.format);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Format::italic()
|
||||
*/
|
||||
PHP_METHOD(vtiful_format, italic)
|
||||
{
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
format_object *obj = Z_FORMAT_P(getThis());
|
||||
|
||||
if (obj->ptr.format) {
|
||||
format_set_italic(obj->ptr.format);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Format::underline()
|
||||
*/
|
||||
PHP_METHOD(vtiful_format, underline)
|
||||
{
|
||||
zend_long style = 0;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_LONG(style)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
format_object *obj = Z_FORMAT_P(getThis());
|
||||
|
||||
if (obj->ptr.format) {
|
||||
format_set_underline(obj->ptr.format, style);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Format::unlocked()
|
||||
*/
|
||||
PHP_METHOD(vtiful_format, unlocked)
|
||||
{
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
format_object *obj = Z_FORMAT_P(getThis());
|
||||
|
||||
if (obj->ptr.format) {
|
||||
format_set_unlocked(obj->ptr.format);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Format::align()
|
||||
*/
|
||||
PHP_METHOD(vtiful_format, align)
|
||||
{
|
||||
zval *args = NULL;
|
||||
int argc, i;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, -1)
|
||||
Z_PARAM_VARIADIC('+', args, argc)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
format_object *obj = Z_FORMAT_P(getThis());
|
||||
|
||||
for (i = 0; i < argc; ++i) {
|
||||
zval *arg = args + i;
|
||||
|
||||
if (Z_TYPE_P(arg) != IS_LONG) {
|
||||
zend_throw_exception(vtiful_exception_ce, "Format exception, please view the manual", 150);
|
||||
}
|
||||
|
||||
if (obj->ptr.format) {
|
||||
format_set_align(obj->ptr.format, Z_LVAL_P(arg));
|
||||
}
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Format::fontColor(int $color)
|
||||
*/
|
||||
PHP_METHOD(vtiful_format, fontColor)
|
||||
{
|
||||
zend_long color = 0;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_LONG(color)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
format_object *obj = Z_FORMAT_P(getThis());
|
||||
|
||||
if (obj->ptr.format) {
|
||||
format_set_font_color(obj->ptr.format, color);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Format::number(string $format)
|
||||
*/
|
||||
PHP_METHOD(vtiful_format, number)
|
||||
{
|
||||
zend_string *format;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_STR(format)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
format_object *obj = Z_FORMAT_P(getThis());
|
||||
|
||||
if (obj->ptr.format) {
|
||||
format_set_num_format(obj->ptr.format, ZSTR_VAL(format));
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Format::background(int $color [, int $pattern = \Vtiful\Kernel\Format::PATTERN_SOLID])
|
||||
*/
|
||||
PHP_METHOD(vtiful_format, background)
|
||||
{
|
||||
zend_long pattern = LXW_PATTERN_SOLID, color = 0;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 2)
|
||||
Z_PARAM_LONG(color)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_LONG(pattern)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
format_object *obj = Z_FORMAT_P(getThis());
|
||||
|
||||
if (obj->ptr.format) {
|
||||
format_set_pattern(obj->ptr.format, pattern);
|
||||
format_set_bg_color(obj->ptr.format, color);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Format::fontSize(double $size)
|
||||
*/
|
||||
PHP_METHOD(vtiful_format, fontSize)
|
||||
{
|
||||
double size;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_DOUBLE(size)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
format_object *obj = Z_FORMAT_P(getThis());
|
||||
|
||||
if (obj->ptr.format) {
|
||||
format_set_font_size(obj->ptr.format, size);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Format::font(string $fontName)
|
||||
*/
|
||||
PHP_METHOD(vtiful_format, font)
|
||||
{
|
||||
zend_string *font_name = NULL;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_STR(font_name)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
format_object *obj = Z_FORMAT_P(getThis());
|
||||
|
||||
if (obj->ptr.format) {
|
||||
format_set_font_name(obj->ptr.format, ZSTR_VAL(font_name));
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Format::strikeout()
|
||||
*/
|
||||
PHP_METHOD(vtiful_format, strikeout)
|
||||
{
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
format_object *obj = Z_FORMAT_P(getThis());
|
||||
|
||||
if (obj->ptr.format) {
|
||||
format_set_font_strikeout(obj->ptr.format);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Format::wrap()
|
||||
*/
|
||||
PHP_METHOD(vtiful_format, wrap)
|
||||
{
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
format_object *obj = Z_FORMAT_P(getThis());
|
||||
|
||||
if (obj->ptr.format) {
|
||||
format_set_text_wrap(obj->ptr.format);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Format::border()
|
||||
*/
|
||||
PHP_METHOD(vtiful_format, border)
|
||||
{
|
||||
zend_long style = 0;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_LONG(style)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
format_object *obj = Z_FORMAT_P(getThis());
|
||||
|
||||
if (obj->ptr.format) {
|
||||
format_set_border(obj->ptr.format, style);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Format::borderOfTheFourSides(int $top, int $right, int $bottom, int $left)
|
||||
*/
|
||||
PHP_METHOD(vtiful_format, borderOfTheFourSides)
|
||||
{
|
||||
zend_long top = LXW_BORDER_NONE, right = LXW_BORDER_NONE, bottom = LXW_BORDER_NONE, left = LXW_BORDER_NONE;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(0, 4)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_LONG_OR_NULL(top, _dummy)
|
||||
Z_PARAM_LONG_OR_NULL(right, _dummy)
|
||||
Z_PARAM_LONG_OR_NULL(bottom, _dummy)
|
||||
Z_PARAM_LONG_OR_NULL(left, _dummy)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
format_object *obj = Z_FORMAT_P(getThis());
|
||||
|
||||
if (obj->ptr.format) {
|
||||
format_set_top(obj->ptr.format, top);
|
||||
format_set_right(obj->ptr.format, right);
|
||||
format_set_bottom(obj->ptr.format, bottom);
|
||||
format_set_left(obj->ptr.format, left);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Format::borderColor(int $color)
|
||||
*/
|
||||
PHP_METHOD(vtiful_format, borderColor)
|
||||
{
|
||||
zend_long color = -1;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_LONG(color)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
format_object *obj = Z_FORMAT_P(getThis());
|
||||
|
||||
if (obj->ptr.format && color > 0) {
|
||||
format_set_border_color(obj->ptr.format, color);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Format::borderColorOfTheFourSides(int $topColor, int $rightColor, int $bottomColor, int $leftColor)
|
||||
*/
|
||||
PHP_METHOD(vtiful_format, borderColorOfTheFourSides)
|
||||
{
|
||||
zend_long top = -1, right = -1, bottom = -1, left = -1;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(0, 4)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_LONG_OR_NULL(top, _dummy)
|
||||
Z_PARAM_LONG_OR_NULL(right, _dummy)
|
||||
Z_PARAM_LONG_OR_NULL(bottom, _dummy)
|
||||
Z_PARAM_LONG_OR_NULL(left, _dummy)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
format_object *obj = Z_FORMAT_P(getThis());
|
||||
|
||||
if (obj->ptr.format) {
|
||||
if (top > 0) {
|
||||
format_set_top_color(obj->ptr.format, top);
|
||||
}
|
||||
|
||||
if (right > 0) {
|
||||
format_set_right_color(obj->ptr.format, right);
|
||||
}
|
||||
|
||||
if (bottom > 0) {
|
||||
format_set_bottom_color(obj->ptr.format, bottom);
|
||||
}
|
||||
|
||||
if (left > 0) {
|
||||
format_set_left_color(obj->ptr.format, left);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Format::toResource()
|
||||
*/
|
||||
PHP_METHOD(vtiful_format, toResource)
|
||||
{
|
||||
format_object *obj = Z_FORMAT_P(getThis());
|
||||
|
||||
RETURN_RES(zend_register_resource(obj->ptr.format, le_xls_writer));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ format_methods
|
||||
*/
|
||||
zend_function_entry format_methods[] = {
|
||||
PHP_ME(vtiful_format, __construct, format_construct_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_format, wrap, format_wrap_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_format, bold, format_bold_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_format, italic, format_italic_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_format, border, format_border_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_format, borderOfTheFourSides, format_border_of_the_four_sides_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_format, borderColor, format_border_color_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_format, borderColorOfTheFourSides, format_border_color_of_the_four_sides_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_format, align, format_align_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_format, number, format_number_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_format, fontColor, format_color_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_format, font, format_font_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_format, fontSize, format_size_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_format, strikeout, format_strikeout_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_format, underline, format_underline_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_format, unlocked, format_unlocked_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_format, toResource, format_to_resource_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_format, background, format_background_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_FE_END
|
||||
};
|
||||
/* }}} */
|
||||
|
||||
/** {{{ VTIFUL_STARTUP_FUNCTION
|
||||
*/
|
||||
VTIFUL_STARTUP_FUNCTION(format) {
|
||||
zend_class_entry ce;
|
||||
|
||||
INIT_NS_CLASS_ENTRY(ce, "Vtiful\\Kernel", "Format", format_methods);
|
||||
ce.create_object = format_objects_new;
|
||||
vtiful_format_ce = zend_register_internal_class(&ce);
|
||||
|
||||
memcpy(&format_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
|
||||
format_handlers.offset = XtOffsetOf(format_object, zo);
|
||||
format_handlers.free_obj = format_objects_free;
|
||||
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "UNDERLINE_SINGLE", LXW_UNDERLINE_SINGLE)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "UNDERLINE_DOUBLE ", LXW_UNDERLINE_DOUBLE)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "UNDERLINE_SINGLE_ACCOUNTING", LXW_UNDERLINE_SINGLE_ACCOUNTING)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "UNDERLINE_DOUBLE_ACCOUNTING", LXW_UNDERLINE_DOUBLE_ACCOUNTING)
|
||||
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "FORMAT_ALIGN_LEFT", LXW_ALIGN_LEFT)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "FORMAT_ALIGN_CENTER", LXW_ALIGN_CENTER)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "FORMAT_ALIGN_RIGHT", LXW_ALIGN_RIGHT)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "FORMAT_ALIGN_FILL", LXW_ALIGN_FILL)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "FORMAT_ALIGN_JUSTIFY", LXW_ALIGN_JUSTIFY)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "FORMAT_ALIGN_CENTER_ACROSS", LXW_ALIGN_CENTER_ACROSS)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "FORMAT_ALIGN_DISTRIBUTED", LXW_ALIGN_DISTRIBUTED)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "FORMAT_ALIGN_VERTICAL_TOP", LXW_ALIGN_VERTICAL_TOP)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "FORMAT_ALIGN_VERTICAL_BOTTOM", LXW_ALIGN_VERTICAL_BOTTOM)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "FORMAT_ALIGN_VERTICAL_CENTER", LXW_ALIGN_VERTICAL_CENTER)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "FORMAT_ALIGN_VERTICAL_JUSTIFY", LXW_ALIGN_VERTICAL_JUSTIFY)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "FORMAT_ALIGN_VERTICAL_DISTRIBUTED", LXW_ALIGN_VERTICAL_DISTRIBUTED)
|
||||
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "COLOR_BLACK", LXW_COLOR_BLACK)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "COLOR_BLUE", LXW_COLOR_BLUE)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "COLOR_BROWN", LXW_COLOR_BROWN)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "COLOR_CYAN", LXW_COLOR_CYAN)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "COLOR_GRAY", LXW_COLOR_GRAY)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "COLOR_GREEN", LXW_COLOR_GREEN)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "COLOR_LIME", LXW_COLOR_LIME)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "COLOR_MAGENTA", LXW_COLOR_MAGENTA)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "COLOR_NAVY", LXW_COLOR_NAVY)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "COLOR_ORANGE", LXW_COLOR_ORANGE)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "COLOR_PINK", LXW_COLOR_PINK)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "COLOR_PURPLE", LXW_COLOR_PURPLE)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "COLOR_RED", LXW_COLOR_RED)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "COLOR_SILVER", LXW_COLOR_SILVER)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "COLOR_WHITE", LXW_COLOR_WHITE)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "COLOR_YELLOW", LXW_COLOR_YELLOW)
|
||||
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "PATTERN_NONE", LXW_PATTERN_NONE)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "PATTERN_SOLID", LXW_PATTERN_SOLID)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "PATTERN_MEDIUM_GRAY", LXW_PATTERN_MEDIUM_GRAY)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "PATTERN_DARK_GRAY", LXW_PATTERN_DARK_GRAY)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "PATTERN_LIGHT_GRAY", LXW_PATTERN_LIGHT_GRAY)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "PATTERN_DARK_HORIZONTAL", LXW_PATTERN_DARK_HORIZONTAL)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "PATTERN_DARK_VERTICAL", LXW_PATTERN_DARK_VERTICAL)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "PATTERN_DARK_DOWN", LXW_PATTERN_DARK_DOWN)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "PATTERN_DARK_UP", LXW_PATTERN_DARK_UP)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "PATTERN_DARK_GRID", LXW_PATTERN_DARK_GRID)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "PATTERN_DARK_TRELLIS", LXW_PATTERN_DARK_TRELLIS)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "PATTERN_LIGHT_HORIZONTAL", LXW_PATTERN_LIGHT_HORIZONTAL)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "PATTERN_LIGHT_VERTICAL", LXW_PATTERN_LIGHT_VERTICAL)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "PATTERN_LIGHT_DOWN", LXW_PATTERN_LIGHT_DOWN)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "PATTERN_LIGHT_UP", LXW_PATTERN_LIGHT_UP)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "PATTERN_LIGHT_GRID", LXW_PATTERN_LIGHT_GRID)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "PATTERN_LIGHT_TRELLIS", LXW_PATTERN_LIGHT_TRELLIS)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "PATTERN_GRAY_125", LXW_PATTERN_GRAY_125)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "PATTERN_GRAY_0625", LXW_PATTERN_GRAY_0625)
|
||||
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "BORDER_NONE", LXW_BORDER_NONE)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "BORDER_THIN", LXW_BORDER_THIN)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "BORDER_MEDIUM", LXW_BORDER_MEDIUM)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "BORDER_DASHED", LXW_BORDER_DASHED)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "BORDER_DOTTED", LXW_BORDER_DOTTED)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "BORDER_THICK", LXW_BORDER_THICK)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "BORDER_DOUBLE", LXW_BORDER_DOUBLE)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "BORDER_HAIR", LXW_BORDER_HAIR)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "BORDER_MEDIUM_DASHED", LXW_BORDER_MEDIUM_DASHED)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "BORDER_DASH_DOT", LXW_BORDER_DASH_DOT)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "BORDER_MEDIUM_DASH_DOT", LXW_BORDER_MEDIUM_DASH_DOT)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "BORDER_DASH_DOT_DOT", LXW_BORDER_DASH_DOT_DOT)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "BORDER_MEDIUM_DASH_DOT_DOT", LXW_BORDER_MEDIUM_DASH_DOT_DOT)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "BORDER_SLANT_DASH_DOT", LXW_BORDER_SLANT_DASH_DOT)
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
121
kernel/format.dep
Normal file
121
kernel/format.dep
Normal file
@ -0,0 +1,121 @@
|
||||
kernel/format.lo: \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/kernel/format.c \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/xlswriter.h \
|
||||
config.h /usr/local/etc/php/include/php/main/php.h \
|
||||
/usr/local/etc/php/include/php/main/php_version.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_types.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_portability.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_config.h \
|
||||
/usr/local/etc/php/include/php/main/../main/php_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/../TSRM/TSRM.h \
|
||||
/usr/local/etc/php/include/php/main/php_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_range_check.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_long.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_map_ptr.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_errors.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_alloc.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_alloc_sizes.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_llist.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_string.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_hash.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_sort.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ast.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_gc.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_hrtime.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_variables.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_iterators.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_stream.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_str_public.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_string_public.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_signal.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_max_execution_timer.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_object_handlers.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_operators.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_strtod.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_multiply.h \
|
||||
/usr/local/etc/php/include/php/main/php_compat.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_API.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_modules.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_compile.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_globals.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_globals_macros.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_atomic.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ptr_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_objects.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_objects_API.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_float.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_multibyte.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_arena.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_call_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_vm_opcodes.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_build.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_list.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_execute.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_type_info.h \
|
||||
/usr/local/etc/php/include/php/main/build-defs.h \
|
||||
/usr/local/etc/php/include/php/main/snprintf.h \
|
||||
/usr/local/etc/php/include/php/main/spprintf.h \
|
||||
/usr/local/etc/php/include/php/main/php_syslog.h \
|
||||
/usr/local/etc/php/include/php/main/php_output.h \
|
||||
/usr/local/etc/php/include/php/main/php_streams.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_context.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_filter_api.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_transport.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_plain_wrapper.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_glob_wrapper.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_userspace.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_mmap.h \
|
||||
/usr/local/etc/php/include/php/main/php_memory_streams.h \
|
||||
/usr/local/etc/php/include/php/main/fopen_wrappers.h \
|
||||
/usr/local/etc/php/include/php/main/php_globals.h \
|
||||
/usr/local/etc/php/include/php/main/php_ini.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ini.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_virtual_cwd.h \
|
||||
/usr/local/etc/php/include/php/TSRM/TSRM.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_constants.h \
|
||||
/usr/local/etc/php/include/php/main/php_reentrancy.h \
|
||||
/usr/local/etc/php/include/php/ext/date/php_date.h \
|
||||
/usr/local/etc/php/include/php/ext/date/lib/timelib.h \
|
||||
/usr/local/etc/php/include/php/ext/date/lib/timelib_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_str.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_exceptions.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/workbook.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/worksheet.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/shared_strings.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/common.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/queue.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/tree.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/chart.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/format.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/hash_table.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/drawing.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/styles.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/utility.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/xmlwriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/relationships.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/chartsheet.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/packager.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/zip.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/app.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/core.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/custom.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/theme.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/content_types.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/vml.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/comment.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/metadata.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/common.h \
|
||||
php_xlswriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/excel.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/validation.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/exception.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/format.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/chart.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/rich_string.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/help.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxio/include/xlsxio_read.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/read.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/csv.h
|
107
kernel/help.c
Normal file
107
kernel/help.c
Normal file
@ -0,0 +1,107 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| XlsWriter Extension |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 2017-2018 The Viest |
|
||||
+----------------------------------------------------------------------+
|
||||
| http://www.viest.me |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: viest <dev@service.viest.me> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "xlswriter.h"
|
||||
#include "ext/date/php_date.h"
|
||||
#include "ext/standard/php_math.h"
|
||||
#include "ext/standard/php_filestat.h"
|
||||
|
||||
/* {{{ */
|
||||
zend_long date_double_to_timestamp(double value) {
|
||||
double days, partDay, hours, minutes, seconds;
|
||||
|
||||
days = floor(value);
|
||||
partDay = value - days;
|
||||
hours = floor(partDay * 24);
|
||||
partDay = partDay * 24 - hours;
|
||||
minutes = floor(partDay * 60);
|
||||
partDay = partDay * 60 - minutes;
|
||||
seconds = _php_math_round(partDay * 60, 0, PHP_ROUND_HALF_UP);
|
||||
|
||||
zval datetime;
|
||||
php_date_instantiate(php_date_get_date_ce(), &datetime);
|
||||
php_date_initialize(Z_PHPDATE_P(&datetime), ZEND_STRL("1899-12-30"), NULL, NULL, 1);
|
||||
|
||||
zval _modify_args[1], _modify_result;
|
||||
smart_str _modify_arg_string = {0};
|
||||
if (days >= 0) {
|
||||
smart_str_appendl(&_modify_arg_string, "+", 1);
|
||||
}
|
||||
smart_str_append_long(&_modify_arg_string, days);
|
||||
smart_str_appendl(&_modify_arg_string, " days", 5);
|
||||
ZSTR_VAL(_modify_arg_string.s)[ZSTR_LEN(_modify_arg_string.s)] = '\0';
|
||||
ZVAL_STR(&_modify_args[0], _modify_arg_string.s);
|
||||
call_object_method(&datetime, "modify", 1, _modify_args, &_modify_result);
|
||||
zval_ptr_dtor(&datetime);
|
||||
|
||||
zval _set_time_args[3], _set_time_result;
|
||||
ZVAL_LONG(&_set_time_args[0], (zend_long)hours);
|
||||
ZVAL_LONG(&_set_time_args[1], (zend_long)minutes);
|
||||
ZVAL_LONG(&_set_time_args[2], (zend_long)seconds);
|
||||
call_object_method(&_modify_result, "setTime", 3, _set_time_args, &_set_time_result);
|
||||
zval_ptr_dtor(&_modify_result);
|
||||
|
||||
zval _format_args[1], _format_result;
|
||||
ZVAL_STRING(&_format_args[0], "U");
|
||||
call_object_method(&_set_time_result, "format", 1, _format_args, &_format_result);
|
||||
zval_ptr_dtor(&_set_time_result);
|
||||
|
||||
zend_long timestamp = ZEND_STRTOL(Z_STRVAL(_format_result), NULL ,10);
|
||||
zval_ptr_dtor(&_format_result);
|
||||
|
||||
return timestamp;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ */
|
||||
unsigned int directory_exists(const char *path) {
|
||||
zval dir_exists;
|
||||
|
||||
#if PHP_VERSION_ID >= 80100
|
||||
zend_string *zs_path = zend_string_init(path, strlen(path), 0);
|
||||
php_stat(zs_path, FS_IS_DIR, &dir_exists);
|
||||
zend_string_release(zs_path);
|
||||
#else
|
||||
php_stat(path, strlen(path), FS_IS_DIR, &dir_exists);
|
||||
#endif
|
||||
|
||||
if (Z_TYPE(dir_exists) == IS_FALSE) {
|
||||
zval_ptr_dtor(&dir_exists);
|
||||
return XLSWRITER_FALSE;
|
||||
}
|
||||
|
||||
zval_ptr_dtor(&dir_exists);
|
||||
return XLSWRITER_TRUE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ */
|
||||
unsigned int file_exists(const char *path) {
|
||||
zval file_exists;
|
||||
|
||||
#if PHP_VERSION_ID >= 80100
|
||||
zend_string *zs_path = zend_string_init(path, strlen(path), 0);
|
||||
php_stat(zs_path, FS_IS_FILE, &file_exists);
|
||||
zend_string_release(zs_path);
|
||||
#else
|
||||
php_stat(path, strlen(path), FS_IS_FILE, &file_exists);
|
||||
#endif
|
||||
|
||||
if (Z_TYPE(file_exists) == IS_FALSE) {
|
||||
zval_ptr_dtor(&file_exists);
|
||||
return XLSWRITER_FALSE;
|
||||
}
|
||||
|
||||
zval_ptr_dtor(&file_exists);
|
||||
return XLSWRITER_TRUE;
|
||||
}
|
||||
/* }}} */
|
123
kernel/help.dep
Normal file
123
kernel/help.dep
Normal file
@ -0,0 +1,123 @@
|
||||
kernel/help.lo: \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/kernel/help.c \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/xlswriter.h \
|
||||
config.h /usr/local/etc/php/include/php/main/php.h \
|
||||
/usr/local/etc/php/include/php/main/php_version.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_types.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_portability.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_config.h \
|
||||
/usr/local/etc/php/include/php/main/../main/php_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/../TSRM/TSRM.h \
|
||||
/usr/local/etc/php/include/php/main/php_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_range_check.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_long.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_map_ptr.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_errors.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_alloc.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_alloc_sizes.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_llist.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_string.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_hash.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_sort.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ast.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_gc.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_hrtime.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_variables.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_iterators.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_stream.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_str_public.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_string_public.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_signal.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_max_execution_timer.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_object_handlers.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_operators.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_strtod.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_multiply.h \
|
||||
/usr/local/etc/php/include/php/main/php_compat.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_API.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_modules.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_compile.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_globals.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_globals_macros.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_atomic.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ptr_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_objects.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_objects_API.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_float.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_multibyte.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_arena.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_call_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_vm_opcodes.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_build.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_list.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_execute.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_type_info.h \
|
||||
/usr/local/etc/php/include/php/main/build-defs.h \
|
||||
/usr/local/etc/php/include/php/main/snprintf.h \
|
||||
/usr/local/etc/php/include/php/main/spprintf.h \
|
||||
/usr/local/etc/php/include/php/main/php_syslog.h \
|
||||
/usr/local/etc/php/include/php/main/php_output.h \
|
||||
/usr/local/etc/php/include/php/main/php_streams.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_context.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_filter_api.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_transport.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_plain_wrapper.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_glob_wrapper.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_userspace.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_mmap.h \
|
||||
/usr/local/etc/php/include/php/main/php_memory_streams.h \
|
||||
/usr/local/etc/php/include/php/main/fopen_wrappers.h \
|
||||
/usr/local/etc/php/include/php/main/php_globals.h \
|
||||
/usr/local/etc/php/include/php/main/php_ini.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ini.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_virtual_cwd.h \
|
||||
/usr/local/etc/php/include/php/TSRM/TSRM.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_constants.h \
|
||||
/usr/local/etc/php/include/php/main/php_reentrancy.h \
|
||||
/usr/local/etc/php/include/php/ext/date/php_date.h \
|
||||
/usr/local/etc/php/include/php/ext/date/lib/timelib.h \
|
||||
/usr/local/etc/php/include/php/ext/date/lib/timelib_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_str.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_exceptions.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/workbook.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/worksheet.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/shared_strings.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/common.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/queue.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/tree.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/chart.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/format.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/hash_table.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/drawing.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/styles.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/utility.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/xmlwriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/relationships.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/chartsheet.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/packager.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/zip.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/app.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/core.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/custom.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/theme.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/content_types.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/vml.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/comment.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/metadata.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/common.h \
|
||||
php_xlswriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/excel.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/validation.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/exception.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/format.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/chart.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/rich_string.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/help.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxio/include/xlsxio_read.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/read.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/csv.h \
|
||||
/usr/local/etc/php/include/php/ext/standard/php_math.h \
|
||||
/usr/local/etc/php/include/php/ext/standard/php_filestat.h
|
470
kernel/read.c
Normal file
470
kernel/read.c
Normal file
@ -0,0 +1,470 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| XlsWriter Extension |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 2017-2018 The Viest |
|
||||
+----------------------------------------------------------------------+
|
||||
| http://www.viest.me |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: viest <dev@service.viest.me> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "xlswriter.h"
|
||||
#include "ext/date/php_date.h"
|
||||
|
||||
/* {{{ */
|
||||
xlsxioreader file_open(const char *directory, const char *file_name) {
|
||||
char *path = (char *)emalloc(strlen(directory) + strlen(file_name) + 2);
|
||||
xlsxioreader file;
|
||||
|
||||
strcpy(path, directory);
|
||||
strcat(path, "/");
|
||||
strcat(path, file_name);
|
||||
|
||||
if (file_exists(path) == XLSWRITER_FALSE) {
|
||||
zend_string *message = char_join_to_zend_str("File not found, file path:", path);
|
||||
zend_throw_exception(vtiful_exception_ce, ZSTR_VAL(message), 121);
|
||||
|
||||
zend_string_free(message);
|
||||
efree(path);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((file = xlsxioread_open(path)) == NULL) {
|
||||
zend_string *message = char_join_to_zend_str("Failed to open file, file path:", path);
|
||||
zend_throw_exception(vtiful_exception_ce, ZSTR_VAL(message), 100);
|
||||
|
||||
zend_string_free(message);
|
||||
efree(path);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
efree(path);
|
||||
return file;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ */
|
||||
xlsxioreadersheet sheet_open(xlsxioreader file_t, const zend_string *zs_sheet_name_t, const zend_long zl_flag)
|
||||
{
|
||||
if (zs_sheet_name_t == NULL) {
|
||||
return xlsxioread_sheet_open(file_t, NULL, zl_flag);
|
||||
}
|
||||
|
||||
return xlsxioread_sheet_open(file_t, ZSTR_VAL(zs_sheet_name_t), zl_flag);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ */
|
||||
void sheet_list(xlsxioreader file_t, zval *zv_result_t)
|
||||
{
|
||||
const char *sheet_name = NULL;
|
||||
xlsxioreadersheetlist sheet_list = NULL;
|
||||
|
||||
if (Z_TYPE_P(zv_result_t) != IS_ARRAY) {
|
||||
array_init(zv_result_t);
|
||||
}
|
||||
|
||||
if ((sheet_list = xlsxioread_sheetlist_open(file_t)) == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
while ((sheet_name = xlsxioread_sheetlist_next(sheet_list)) != NULL) {
|
||||
add_next_index_stringl(zv_result_t, sheet_name, strlen(sheet_name));
|
||||
}
|
||||
|
||||
xlsxioread_sheetlist_close(sheet_list);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ */
|
||||
int is_number(const char *value)
|
||||
{
|
||||
if (strspn(value, ".0123456789") == strlen(value)) {
|
||||
return XLSWRITER_TRUE;
|
||||
}
|
||||
|
||||
return XLSWRITER_FALSE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ */
|
||||
void data_to_null(zval *zv_result_t)
|
||||
{
|
||||
if (Z_TYPE_P(zv_result_t) == IS_ARRAY) {
|
||||
add_next_index_null(zv_result_t);
|
||||
} else {
|
||||
ZVAL_NULL(zv_result_t);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ */
|
||||
void data_to_custom_type(const char *string_value, const size_t string_value_length, const zend_ulong type, zval *zv_result_t, const zend_ulong zv_hashtable_index)
|
||||
{
|
||||
if (type == 0) {
|
||||
goto STRING;
|
||||
}
|
||||
|
||||
if (!is_number(string_value)) {
|
||||
goto STRING;
|
||||
}
|
||||
|
||||
if (type & READ_TYPE_DATETIME) {
|
||||
if (string_value_length == 0) {
|
||||
data_to_null(zv_result_t);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
zend_long timestamp = date_double_to_timestamp(zend_strtod(string_value, NULL));
|
||||
|
||||
// GMT
|
||||
// if (value != 0) {
|
||||
// timestamp = (value - 25569) * 86400;
|
||||
// }
|
||||
|
||||
if (Z_TYPE_P(zv_result_t) == IS_ARRAY) {
|
||||
add_index_long(zv_result_t, zv_hashtable_index, timestamp);
|
||||
} else {
|
||||
ZVAL_LONG(zv_result_t, timestamp);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (type & READ_TYPE_DOUBLE) {
|
||||
if (string_value_length == 0) {
|
||||
data_to_null(zv_result_t);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (Z_TYPE_P(zv_result_t) == IS_ARRAY) {
|
||||
add_index_double(zv_result_t, zv_hashtable_index,strtod(string_value, NULL));
|
||||
} else {
|
||||
ZVAL_DOUBLE(zv_result_t, strtod(string_value, NULL));
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (type & READ_TYPE_INT) {
|
||||
if (string_value_length == 0) {
|
||||
data_to_null(zv_result_t);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
zend_long _long_value;
|
||||
|
||||
sscanf(string_value, ZEND_LONG_FMT, &_long_value);
|
||||
|
||||
if (Z_TYPE_P(zv_result_t) == IS_ARRAY) {
|
||||
add_index_long(zv_result_t, zv_hashtable_index, _long_value);
|
||||
} else {
|
||||
ZVAL_LONG(zv_result_t, _long_value);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
STRING:
|
||||
|
||||
{
|
||||
if (!(type & READ_TYPE_STRING)) {
|
||||
zend_long _long = 0; double _double = 0;
|
||||
is_numeric_string(string_value, string_value_length, &_long, &_double, 0);
|
||||
|
||||
if (Z_TYPE_P(zv_result_t) == IS_ARRAY) {
|
||||
if (_double > 0 && _double <= (double)ZEND_LONG_MAX) {
|
||||
add_index_double(zv_result_t, zv_hashtable_index, _double);
|
||||
return;
|
||||
}
|
||||
|
||||
if (_long > 0 && _long <= ZEND_LONG_MAX) {
|
||||
add_index_long(zv_result_t, zv_hashtable_index, _long);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (_double > 0 && _double <= (double)ZEND_LONG_MAX) {
|
||||
ZVAL_DOUBLE(zv_result_t, _double);
|
||||
return;
|
||||
}
|
||||
|
||||
if (_long > 0 && _long <= ZEND_LONG_MAX) {
|
||||
ZVAL_LONG(zv_result_t, _long);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Z_TYPE_P(zv_result_t) == IS_ARRAY) {
|
||||
add_index_stringl(zv_result_t, zv_hashtable_index, string_value, string_value_length);
|
||||
return;
|
||||
}
|
||||
|
||||
ZVAL_STRINGL(zv_result_t, string_value, string_value_length);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ */
|
||||
int sheet_read_row(xlsxioreadersheet sheet_t)
|
||||
{
|
||||
return xlsxioread_sheet_next_row(sheet_t);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ */
|
||||
unsigned int load_sheet_current_row_data(xlsxioreadersheet sheet_t, zval *zv_result_t, zval *zv_type_arr_t, zend_long data_type_default, unsigned int flag)
|
||||
{
|
||||
zend_long _type, _cell_index = 0, _last_cell_index = 0;
|
||||
zend_bool _skip_empty_value_cell = 0;
|
||||
zend_array *_za_type_t = NULL;
|
||||
char *_string_value = NULL;
|
||||
zval *_current_type = NULL;
|
||||
|
||||
if (flag && !sheet_read_row(sheet_t)) {
|
||||
return XLSWRITER_FALSE;
|
||||
}
|
||||
|
||||
if (xlsxioread_sheet_flags(sheet_t) & SKIP_EMPTY_VALUE) {
|
||||
_skip_empty_value_cell = 1;
|
||||
}
|
||||
|
||||
if (Z_TYPE_P(zv_result_t) != IS_ARRAY) {
|
||||
array_init(zv_result_t);
|
||||
}
|
||||
|
||||
if (zv_type_arr_t != NULL && Z_TYPE_P(zv_type_arr_t) == IS_ARRAY) {
|
||||
_za_type_t = Z_ARR_P(zv_type_arr_t);
|
||||
}
|
||||
|
||||
while ((_string_value = xlsxioread_sheet_next_cell(sheet_t)) != NULL)
|
||||
{
|
||||
size_t _string_value_length = strlen(_string_value);
|
||||
|
||||
_type = READ_TYPE_EMPTY;
|
||||
_last_cell_index = xlsxioread_sheet_last_column_index(sheet_t) - 1;
|
||||
|
||||
if (_last_cell_index < 0 || (_skip_empty_value_cell && _string_value_length == 0)) {
|
||||
goto FREE_TMP_VALUE;
|
||||
}
|
||||
|
||||
if (_last_cell_index > _cell_index) {
|
||||
_cell_index = _last_cell_index;
|
||||
}
|
||||
|
||||
if (_za_type_t != NULL) {
|
||||
_current_type = zend_hash_index_find(_za_type_t, _cell_index);
|
||||
|
||||
if (_current_type != NULL && Z_TYPE_P(_current_type) == IS_LONG) {
|
||||
_type = Z_LVAL_P(_current_type);
|
||||
} else {
|
||||
_type = data_type_default;
|
||||
}
|
||||
} else {
|
||||
_type = data_type_default;
|
||||
}
|
||||
|
||||
data_to_custom_type(_string_value, _string_value_length, _type, zv_result_t, _cell_index);
|
||||
|
||||
FREE_TMP_VALUE:
|
||||
|
||||
++_cell_index;
|
||||
free(_string_value);
|
||||
}
|
||||
|
||||
return XLSWRITER_TRUE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ */
|
||||
int sheet_row_callback (size_t row, size_t max_col, void* callback_data)
|
||||
{
|
||||
if (callback_data == NULL) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
xls_read_callback_data *_callback_data = (xls_read_callback_data *)callback_data;
|
||||
|
||||
zval args[3], retval;
|
||||
|
||||
_callback_data->fci->retval = &retval;
|
||||
_callback_data->fci->params = args;
|
||||
_callback_data->fci->param_count = 3;
|
||||
|
||||
ZVAL_LONG(&args[0], (row - 1));
|
||||
ZVAL_LONG(&args[1], (max_col - 1));
|
||||
ZVAL_STRING(&args[2], "XLSX_ROW_END");
|
||||
|
||||
zend_call_function(_callback_data->fci, _callback_data->fci_cache);
|
||||
|
||||
zval_ptr_dtor(&args[2]);
|
||||
zval_ptr_dtor(&retval);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ */
|
||||
int sheet_cell_callback (size_t row, size_t col, const char *value, void *callback_data)
|
||||
{
|
||||
size_t _value_length = 0;
|
||||
|
||||
if (value != NULL) {
|
||||
_value_length = strlen(value);
|
||||
}
|
||||
|
||||
if (callback_data == NULL) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
xls_read_callback_data *_callback_data = (xls_read_callback_data *)callback_data;
|
||||
|
||||
if (_callback_data->fci == NULL || _callback_data->fci_cache == NULL) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
zval args[3], retval;
|
||||
|
||||
_callback_data->fci->retval = &retval;
|
||||
_callback_data->fci->params = args;
|
||||
_callback_data->fci->param_count = 3;
|
||||
|
||||
ZVAL_LONG(&args[0], (row - 1));
|
||||
ZVAL_LONG(&args[1], (col - 1));
|
||||
ZVAL_NULL(&args[2]);
|
||||
|
||||
if (value == NULL) {
|
||||
goto CALL_USER_FUNCTION;
|
||||
}
|
||||
|
||||
if (Z_TYPE_P(_callback_data->zv_type_t) != IS_ARRAY && _callback_data->data_type_default == READ_TYPE_EMPTY) {
|
||||
zend_long _long = 0; double _double = 0;
|
||||
|
||||
if (is_numeric_string(value, _value_length, &_long, &_double, 0)) {
|
||||
if (_double > 0) {
|
||||
ZVAL_DOUBLE(&args[2], _double);
|
||||
} else {
|
||||
ZVAL_LONG(&args[2], _long);
|
||||
}
|
||||
} else {
|
||||
ZVAL_STRINGL(&args[2], value, _value_length);
|
||||
}
|
||||
}
|
||||
|
||||
if (Z_TYPE_P(_callback_data->zv_type_t) != IS_ARRAY && _callback_data->data_type_default != READ_TYPE_EMPTY) {
|
||||
data_to_custom_type(value, _value_length, _callback_data->data_type_default, &args[2], 0);
|
||||
}
|
||||
|
||||
if (Z_TYPE_P(_callback_data->zv_type_t) == IS_ARRAY) {
|
||||
zval *_current_type = NULL;
|
||||
zend_ulong _type = READ_TYPE_EMPTY;
|
||||
|
||||
if ((_current_type = zend_hash_index_find(Z_ARR_P(_callback_data->zv_type_t), (col - 1))) != NULL) {
|
||||
if (Z_TYPE_P(_current_type) == IS_LONG) {
|
||||
_type = Z_LVAL_P(_current_type);
|
||||
}
|
||||
}
|
||||
|
||||
data_to_custom_type(value, _value_length, _type, &args[2], 0);
|
||||
}
|
||||
|
||||
CALL_USER_FUNCTION:
|
||||
|
||||
zend_call_function(_callback_data->fci, _callback_data->fci_cache);
|
||||
|
||||
zval_ptr_dtor(&args[2]);
|
||||
zval_ptr_dtor(&retval);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ */
|
||||
unsigned int load_sheet_current_row_data_callback (zend_string *zs_sheet_name_t, xlsxioreader file_t, void *callback_data)
|
||||
{
|
||||
if (zs_sheet_name_t == NULL) {
|
||||
return xlsxioread_process(file_t, NULL, XLSXIOREAD_SKIP_NONE, sheet_cell_callback, sheet_row_callback, callback_data);
|
||||
}
|
||||
|
||||
return xlsxioread_process(file_t, ZSTR_VAL(zs_sheet_name_t), XLSXIOREAD_SKIP_NONE, sheet_cell_callback, sheet_row_callback, callback_data);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ */
|
||||
void load_sheet_row_data (xlsxioreadersheet sheet_t, zend_long sheet_flag, zval *zv_type_t, zend_long data_type_default, zval *zv_result_t)
|
||||
{
|
||||
size_t row_index = 0;
|
||||
|
||||
do {
|
||||
load_sheet_current_row_data(sheet_t, zv_result_t, zv_type_t, data_type_default, READ_ROW);
|
||||
|
||||
if (row_index == xlsxioread_sheet_last_row_index(sheet_t)) {
|
||||
return;
|
||||
}
|
||||
|
||||
row_index = xlsxioread_sheet_last_row_index(sheet_t);
|
||||
|
||||
if (sheet_flag & XLSXIOREAD_SKIP_EMPTY_ROWS
|
||||
&& Z_TYPE_P(zv_result_t) == IS_ARRAY
|
||||
&& zend_hash_num_elements(Z_ARR_P(zv_result_t)) == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
return;
|
||||
} while (1);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ */
|
||||
void load_sheet_all_data (xlsxioreadersheet sheet_t, zend_long sheet_flag, zval *zv_type_t, zend_long data_type_default, zval *zv_result_t)
|
||||
{
|
||||
if (Z_TYPE_P(zv_result_t) != IS_ARRAY) {
|
||||
array_init(zv_result_t);
|
||||
}
|
||||
|
||||
while (sheet_read_row(sheet_t))
|
||||
{
|
||||
zval _zv_tmp_row;
|
||||
ZVAL_NULL(&_zv_tmp_row);
|
||||
|
||||
load_sheet_current_row_data(sheet_t, &_zv_tmp_row, zv_type_t, data_type_default, READ_SKIP_ROW);
|
||||
|
||||
if (sheet_flag & XLSXIOREAD_SKIP_EMPTY_ROWS
|
||||
&& Z_TYPE(_zv_tmp_row) == IS_ARRAY
|
||||
&& zend_hash_num_elements(Z_ARR(_zv_tmp_row)) == 0) {
|
||||
zval_ptr_dtor(&_zv_tmp_row);
|
||||
continue;
|
||||
}
|
||||
|
||||
add_next_index_zval(zv_result_t, &_zv_tmp_row);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
void skip_rows(xlsxioreadersheet sheet_t, zval *zv_type_t, zend_long data_type_default, zend_long zl_skip_row)
|
||||
{
|
||||
while (sheet_read_row(sheet_t))
|
||||
{
|
||||
zval _zv_tmp_row;
|
||||
ZVAL_NULL(&_zv_tmp_row);
|
||||
|
||||
if (xlsxioread_sheet_last_row_index(sheet_t) < zl_skip_row) {
|
||||
sheet_read_row(sheet_t);
|
||||
}
|
||||
|
||||
load_sheet_current_row_data(sheet_t, &_zv_tmp_row, zv_type_t, data_type_default, READ_SKIP_ROW);
|
||||
|
||||
zval_ptr_dtor(&_zv_tmp_row);
|
||||
|
||||
if (xlsxioread_sheet_last_row_index(sheet_t) >= zl_skip_row) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
121
kernel/read.dep
Normal file
121
kernel/read.dep
Normal file
@ -0,0 +1,121 @@
|
||||
kernel/read.lo: \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/kernel/read.c \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/xlswriter.h \
|
||||
config.h /usr/local/etc/php/include/php/main/php.h \
|
||||
/usr/local/etc/php/include/php/main/php_version.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_types.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_portability.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_config.h \
|
||||
/usr/local/etc/php/include/php/main/../main/php_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/../TSRM/TSRM.h \
|
||||
/usr/local/etc/php/include/php/main/php_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_range_check.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_long.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_map_ptr.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_errors.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_alloc.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_alloc_sizes.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_llist.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_string.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_hash.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_sort.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ast.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_gc.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_hrtime.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_variables.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_iterators.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_stream.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_str_public.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_string_public.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_signal.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_max_execution_timer.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_object_handlers.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_operators.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_strtod.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_multiply.h \
|
||||
/usr/local/etc/php/include/php/main/php_compat.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_API.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_modules.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_compile.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_globals.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_globals_macros.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_atomic.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ptr_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_objects.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_objects_API.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_float.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_multibyte.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_arena.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_call_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_vm_opcodes.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_build.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_list.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_execute.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_type_info.h \
|
||||
/usr/local/etc/php/include/php/main/build-defs.h \
|
||||
/usr/local/etc/php/include/php/main/snprintf.h \
|
||||
/usr/local/etc/php/include/php/main/spprintf.h \
|
||||
/usr/local/etc/php/include/php/main/php_syslog.h \
|
||||
/usr/local/etc/php/include/php/main/php_output.h \
|
||||
/usr/local/etc/php/include/php/main/php_streams.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_context.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_filter_api.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_transport.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_plain_wrapper.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_glob_wrapper.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_userspace.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_mmap.h \
|
||||
/usr/local/etc/php/include/php/main/php_memory_streams.h \
|
||||
/usr/local/etc/php/include/php/main/fopen_wrappers.h \
|
||||
/usr/local/etc/php/include/php/main/php_globals.h \
|
||||
/usr/local/etc/php/include/php/main/php_ini.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ini.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_virtual_cwd.h \
|
||||
/usr/local/etc/php/include/php/TSRM/TSRM.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_constants.h \
|
||||
/usr/local/etc/php/include/php/main/php_reentrancy.h \
|
||||
/usr/local/etc/php/include/php/ext/date/php_date.h \
|
||||
/usr/local/etc/php/include/php/ext/date/lib/timelib.h \
|
||||
/usr/local/etc/php/include/php/ext/date/lib/timelib_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_str.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_exceptions.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/workbook.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/worksheet.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/shared_strings.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/common.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/queue.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/tree.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/chart.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/format.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/hash_table.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/drawing.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/styles.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/utility.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/xmlwriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/relationships.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/chartsheet.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/packager.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/zip.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/app.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/core.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/custom.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/theme.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/content_types.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/vml.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/comment.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/metadata.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/common.h \
|
||||
php_xlswriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/excel.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/validation.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/exception.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/format.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/chart.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/rich_string.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/help.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxio/include/xlsxio_read.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/read.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/csv.h
|
86
kernel/resource.c
Normal file
86
kernel/resource.c
Normal file
@ -0,0 +1,86 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| XlsWriter Extension |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 2017-2018 The Viest |
|
||||
+----------------------------------------------------------------------+
|
||||
| http://www.viest.me |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: viest <dev@service.viest.me> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "xlswriter.h"
|
||||
|
||||
/* {{{ */
|
||||
xls_resource_write_t * zval_get_resource(zval *handle)
|
||||
{
|
||||
xls_resource_write_t *res;
|
||||
|
||||
if((res = (xls_resource_write_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 = NULL;
|
||||
|
||||
if (handle == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (zval_get_type(handle) != IS_RESOURCE) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ */
|
||||
lxw_rich_string_tuple *zval_get_rich_string(zval *resource)
|
||||
{
|
||||
lxw_rich_string_tuple *res;
|
||||
|
||||
if((res = (lxw_rich_string_tuple *)zend_fetch_resource(Z_RES_P(resource), VTIFUL_RESOURCE_NAME, le_xls_writer)) == NULL) {
|
||||
zend_throw_exception(vtiful_exception_ce, "rich string resources resolution fail", 210);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ */
|
||||
lxw_data_validation *zval_get_validation(zval *resource)
|
||||
{
|
||||
lxw_data_validation *res;
|
||||
|
||||
if((res = (lxw_data_validation *)zend_fetch_resource(Z_RES_P(resource), VTIFUL_RESOURCE_NAME, le_xls_writer)) == NULL) {
|
||||
zend_throw_exception(vtiful_exception_ce, "validation resources resolution fail", 210);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
/* }}} */
|
121
kernel/resource.dep
Normal file
121
kernel/resource.dep
Normal file
@ -0,0 +1,121 @@
|
||||
kernel/resource.lo: \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/kernel/resource.c \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/xlswriter.h \
|
||||
config.h /usr/local/etc/php/include/php/main/php.h \
|
||||
/usr/local/etc/php/include/php/main/php_version.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_types.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_portability.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_config.h \
|
||||
/usr/local/etc/php/include/php/main/../main/php_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/../TSRM/TSRM.h \
|
||||
/usr/local/etc/php/include/php/main/php_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_range_check.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_long.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_map_ptr.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_errors.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_alloc.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_alloc_sizes.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_llist.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_string.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_hash.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_sort.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ast.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_gc.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_hrtime.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_variables.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_iterators.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_stream.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_str_public.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_string_public.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_signal.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_max_execution_timer.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_object_handlers.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_operators.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_strtod.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_multiply.h \
|
||||
/usr/local/etc/php/include/php/main/php_compat.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_API.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_modules.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_compile.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_globals.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_globals_macros.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_atomic.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ptr_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_objects.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_objects_API.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_float.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_multibyte.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_arena.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_call_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_vm_opcodes.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_build.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_list.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_execute.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_type_info.h \
|
||||
/usr/local/etc/php/include/php/main/build-defs.h \
|
||||
/usr/local/etc/php/include/php/main/snprintf.h \
|
||||
/usr/local/etc/php/include/php/main/spprintf.h \
|
||||
/usr/local/etc/php/include/php/main/php_syslog.h \
|
||||
/usr/local/etc/php/include/php/main/php_output.h \
|
||||
/usr/local/etc/php/include/php/main/php_streams.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_context.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_filter_api.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_transport.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_plain_wrapper.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_glob_wrapper.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_userspace.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_mmap.h \
|
||||
/usr/local/etc/php/include/php/main/php_memory_streams.h \
|
||||
/usr/local/etc/php/include/php/main/fopen_wrappers.h \
|
||||
/usr/local/etc/php/include/php/main/php_globals.h \
|
||||
/usr/local/etc/php/include/php/main/php_ini.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ini.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_virtual_cwd.h \
|
||||
/usr/local/etc/php/include/php/TSRM/TSRM.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_constants.h \
|
||||
/usr/local/etc/php/include/php/main/php_reentrancy.h \
|
||||
/usr/local/etc/php/include/php/ext/date/php_date.h \
|
||||
/usr/local/etc/php/include/php/ext/date/lib/timelib.h \
|
||||
/usr/local/etc/php/include/php/ext/date/lib/timelib_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_str.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_exceptions.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/workbook.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/worksheet.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/shared_strings.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/common.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/queue.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/tree.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/chart.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/format.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/hash_table.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/drawing.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/styles.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/utility.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/xmlwriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/relationships.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/chartsheet.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/packager.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/zip.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/app.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/core.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/custom.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/theme.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/content_types.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/vml.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/comment.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/metadata.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/common.h \
|
||||
php_xlswriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/excel.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/validation.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/exception.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/format.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/chart.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/rich_string.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/help.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxio/include/xlsxio_read.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/read.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/csv.h
|
125
kernel/rich_string.c
Normal file
125
kernel/rich_string.c
Normal file
@ -0,0 +1,125 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| XlsWriter Extension |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 2017-2018 The Viest |
|
||||
+----------------------------------------------------------------------+
|
||||
| http://www.viest.me |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: viest <dev@service.viest.me> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "xlswriter.h"
|
||||
|
||||
zend_class_entry *vtiful_rich_string_ce;
|
||||
|
||||
/* {{{ rich_string_objects_new
|
||||
*/
|
||||
static zend_object_handlers rich_string_handlers;
|
||||
|
||||
static zend_always_inline void *vtiful_rich_string_object_alloc(size_t obj_size, zend_class_entry *ce) {
|
||||
void *obj = emalloc(obj_size);
|
||||
memset(obj, 0, obj_size);
|
||||
return obj;
|
||||
}
|
||||
|
||||
PHP_VTIFUL_API zend_object *rich_string_objects_new(zend_class_entry *ce)
|
||||
{
|
||||
rich_string_object *rich_string = vtiful_rich_string_object_alloc(sizeof(rich_string_object), ce);
|
||||
|
||||
zend_object_std_init(&rich_string->zo, ce);
|
||||
object_properties_init(&rich_string->zo, ce);
|
||||
|
||||
rich_string->ptr.tuple = NULL;
|
||||
rich_string->zo.handlers = &rich_string_handlers;
|
||||
|
||||
return &rich_string->zo;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ rich_string_objects_free
|
||||
*/
|
||||
static void rich_string_objects_free(zend_object *object)
|
||||
{
|
||||
rich_string_object *intern = php_vtiful_rich_string_fetch_object(object);
|
||||
|
||||
if (intern->ptr.tuple != NULL) {
|
||||
efree(intern->ptr.tuple);
|
||||
intern->ptr.tuple = NULL;
|
||||
}
|
||||
|
||||
zend_object_std_dtor(&intern->zo);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ ARG_INFO
|
||||
*/
|
||||
ZEND_BEGIN_ARG_INFO_EX(rich_string_construct_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, text)
|
||||
ZEND_ARG_INFO(0, format_handle)
|
||||
ZEND_END_ARG_INFO()
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\RichString::__construct(string $text, resource $format)
|
||||
*/
|
||||
PHP_METHOD(vtiful_rich_string, __construct)
|
||||
{
|
||||
zend_string *text = NULL;
|
||||
zval *format_handle = NULL;
|
||||
rich_string_object *obj = NULL;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 2)
|
||||
Z_PARAM_STR(text)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_RESOURCE_OR_NULL(format_handle)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
obj = Z_RICH_STR_P(getThis());
|
||||
|
||||
if (obj->ptr.tuple != NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
lxw_rich_string_tuple *instance = (lxw_rich_string_tuple *)ecalloc(1, sizeof(lxw_rich_string_tuple));
|
||||
|
||||
zend_string *zstr = zend_string_copy(text);
|
||||
|
||||
if (format_handle == NULL) {
|
||||
instance->format = NULL;
|
||||
instance->string = ZSTR_VAL(zstr);
|
||||
} else {
|
||||
instance->format = zval_get_format(format_handle);
|
||||
instance->string = ZSTR_VAL(zstr);
|
||||
}
|
||||
|
||||
obj->ptr.tuple = instance;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ rich_string_methods
|
||||
*/
|
||||
zend_function_entry rich_string_methods[] = {
|
||||
PHP_ME(vtiful_rich_string, __construct, rich_string_construct_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_FE_END
|
||||
};
|
||||
/* }}} */
|
||||
|
||||
/** {{{ VTIFUL_STARTUP_FUNCTION
|
||||
*/
|
||||
VTIFUL_STARTUP_FUNCTION(rich_string) {
|
||||
zend_class_entry ce;
|
||||
|
||||
INIT_NS_CLASS_ENTRY(ce, "Vtiful\\Kernel", "RichString", rich_string_methods);
|
||||
ce.create_object = rich_string_objects_new;
|
||||
vtiful_rich_string_ce = zend_register_internal_class(&ce);
|
||||
|
||||
memcpy(&rich_string_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
|
||||
rich_string_handlers.offset = XtOffsetOf(rich_string_object, zo);
|
||||
rich_string_handlers.free_obj = rich_string_objects_free;
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
121
kernel/rich_string.dep
Normal file
121
kernel/rich_string.dep
Normal file
@ -0,0 +1,121 @@
|
||||
kernel/rich_string.lo: \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/kernel/rich_string.c \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/xlswriter.h \
|
||||
config.h /usr/local/etc/php/include/php/main/php.h \
|
||||
/usr/local/etc/php/include/php/main/php_version.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_types.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_portability.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_config.h \
|
||||
/usr/local/etc/php/include/php/main/../main/php_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/../TSRM/TSRM.h \
|
||||
/usr/local/etc/php/include/php/main/php_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_range_check.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_long.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_map_ptr.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_errors.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_alloc.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_alloc_sizes.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_llist.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_string.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_hash.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_sort.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ast.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_gc.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_hrtime.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_variables.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_iterators.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_stream.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_str_public.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_string_public.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_signal.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_max_execution_timer.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_object_handlers.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_operators.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_strtod.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_multiply.h \
|
||||
/usr/local/etc/php/include/php/main/php_compat.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_API.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_modules.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_compile.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_globals.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_globals_macros.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_atomic.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ptr_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_objects.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_objects_API.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_float.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_multibyte.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_arena.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_call_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_vm_opcodes.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_build.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_list.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_execute.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_type_info.h \
|
||||
/usr/local/etc/php/include/php/main/build-defs.h \
|
||||
/usr/local/etc/php/include/php/main/snprintf.h \
|
||||
/usr/local/etc/php/include/php/main/spprintf.h \
|
||||
/usr/local/etc/php/include/php/main/php_syslog.h \
|
||||
/usr/local/etc/php/include/php/main/php_output.h \
|
||||
/usr/local/etc/php/include/php/main/php_streams.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_context.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_filter_api.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_transport.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_plain_wrapper.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_glob_wrapper.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_userspace.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_mmap.h \
|
||||
/usr/local/etc/php/include/php/main/php_memory_streams.h \
|
||||
/usr/local/etc/php/include/php/main/fopen_wrappers.h \
|
||||
/usr/local/etc/php/include/php/main/php_globals.h \
|
||||
/usr/local/etc/php/include/php/main/php_ini.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ini.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_virtual_cwd.h \
|
||||
/usr/local/etc/php/include/php/TSRM/TSRM.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_constants.h \
|
||||
/usr/local/etc/php/include/php/main/php_reentrancy.h \
|
||||
/usr/local/etc/php/include/php/ext/date/php_date.h \
|
||||
/usr/local/etc/php/include/php/ext/date/lib/timelib.h \
|
||||
/usr/local/etc/php/include/php/ext/date/lib/timelib_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_str.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_exceptions.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/workbook.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/worksheet.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/shared_strings.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/common.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/queue.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/tree.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/chart.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/format.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/hash_table.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/drawing.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/styles.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/utility.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/xmlwriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/relationships.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/chartsheet.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/packager.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/zip.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/app.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/core.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/custom.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/theme.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/content_types.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/vml.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/comment.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/metadata.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/common.h \
|
||||
php_xlswriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/excel.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/validation.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/exception.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/format.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/chart.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/rich_string.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/help.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxio/include/xlsxio_read.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/read.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/csv.h
|
826
kernel/validation.c
Normal file
826
kernel/validation.c
Normal file
@ -0,0 +1,826 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| XlsWriter Extension |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 2017-2018 The Viest |
|
||||
+----------------------------------------------------------------------+
|
||||
| http://www.viest.me |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: viest <dev@service.viest.me> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "xlswriter.h"
|
||||
|
||||
zend_class_entry *vtiful_validation_ce;
|
||||
|
||||
/* {{{ validation_objects_new
|
||||
*/
|
||||
static zend_object_handlers validation_handlers;
|
||||
|
||||
static zend_always_inline void *vtiful_validation_object_alloc(size_t obj_size, zend_class_entry *ce) {
|
||||
void *obj = emalloc(obj_size);
|
||||
memset(obj, 0, obj_size);
|
||||
return obj;
|
||||
}
|
||||
|
||||
PHP_VTIFUL_API zend_object *validation_objects_new(zend_class_entry *ce)
|
||||
{
|
||||
validation_object *validation = vtiful_validation_object_alloc(sizeof(validation_object), ce);
|
||||
|
||||
zend_object_std_init(&validation->zo, ce);
|
||||
object_properties_init(&validation->zo, ce);
|
||||
|
||||
validation->ptr.validation = NULL;
|
||||
|
||||
validation->zo.handlers = &validation_handlers;
|
||||
|
||||
return &validation->zo;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ validation_objects_free
|
||||
*/
|
||||
static void validation_objects_free(zend_object *object)
|
||||
{
|
||||
validation_object *intern = php_vtiful_validation_fetch_object(object);
|
||||
|
||||
if (intern->ptr.validation->value_list != NULL) {
|
||||
int index = 0;
|
||||
|
||||
do {
|
||||
if (intern->ptr.validation->value_list[index] == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
efree(intern->ptr.validation->value_list[index]);
|
||||
index++;
|
||||
} while (1);
|
||||
|
||||
efree(intern->ptr.validation->value_list);
|
||||
}
|
||||
|
||||
if (intern->ptr.validation != NULL) {
|
||||
efree(intern->ptr.validation);
|
||||
}
|
||||
|
||||
zend_object_std_dtor(&intern->zo);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ ARG_INFO
|
||||
*/
|
||||
ZEND_BEGIN_ARG_INFO_EX(validation_construct_arginfo, 0, 0, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(validation_type_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, type)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(validation_criteria_type_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, type)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(validation_ignore_blank_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, ignore_blank)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(validation_show_input_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, show_input)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(validation_show_error_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, show_error)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(validation_error_type_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, error_type)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(validation_dropdown_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, dropdown)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(validation_value_number_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, value_number)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(validation_value_formula_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, value_formula)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(validation_value_list_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, value_list)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(validation_value_date_time_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, timestamp)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(validation_minimum_number_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, minimum_number)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(validation_minimum_formula_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, minimum_formula)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(validation_minimum_datetime_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, timestamp)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(validation_maximum_number_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, maximum_number)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(validation_maximum_formula_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, maximum_formula)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(validation_maximum_datetime_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, maximum_datetime)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(validation_input_title_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, input_title)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(validation_input_message_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, input_message)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(validation_error_title_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, error_titile)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(validation_error_message_arginfo, 0, 0, 1)
|
||||
ZEND_ARG_INFO(0, error_message)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(validation_to_resource_arginfo, 0, 0, 1)
|
||||
ZEND_END_ARG_INFO()
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Validation::__construct()
|
||||
*/
|
||||
PHP_METHOD(vtiful_validation, __construct)
|
||||
{
|
||||
validation_object *obj = NULL;
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
obj = Z_VALIDATION_P(getThis());
|
||||
|
||||
if (obj->ptr.validation == NULL) {
|
||||
obj->ptr.validation = ecalloc(1, sizeof(lxw_data_validation));
|
||||
}
|
||||
|
||||
obj->ptr.validation->value_list = NULL;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Validation::validationType()
|
||||
*/
|
||||
PHP_METHOD(vtiful_validation, validationType)
|
||||
{
|
||||
zend_long zl_validate_type = 0;
|
||||
validation_object *obj = NULL;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_LONG(zl_validate_type)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
obj = Z_VALIDATION_P(getThis());
|
||||
|
||||
if (obj->ptr.validation == NULL) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
if (zl_validate_type < LXW_VALIDATION_TYPE_NONE || zl_validate_type > LXW_VALIDATION_TYPE_ANY) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
obj->ptr.validation->validate = zl_validate_type;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Validation::criteriaType()
|
||||
*/
|
||||
PHP_METHOD(vtiful_validation, criteriaType)
|
||||
{
|
||||
zend_long zl_criteria_type = 0;
|
||||
validation_object *obj = NULL;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_LONG(zl_criteria_type)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
obj = Z_VALIDATION_P(getThis());
|
||||
|
||||
if (obj->ptr.validation == NULL) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
if (zl_criteria_type < LXW_VALIDATION_CRITERIA_NONE || zl_criteria_type > LXW_VALIDATION_CRITERIA_LESS_THAN_OR_EQUAL_TO) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
obj->ptr.validation->criteria = zl_criteria_type;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Validation::ignoreBlank()
|
||||
*/
|
||||
PHP_METHOD(vtiful_validation, ignoreBlank)
|
||||
{
|
||||
zend_bool zb_ignore_blank = 1;
|
||||
validation_object *obj = NULL;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(0, 1)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_BOOL(zb_ignore_blank)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
obj = Z_VALIDATION_P(getThis());
|
||||
|
||||
if (obj->ptr.validation == NULL) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
if (zb_ignore_blank) {
|
||||
obj->ptr.validation->ignore_blank = LXW_VALIDATION_ON;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
obj->ptr.validation->ignore_blank = LXW_VALIDATION_OFF;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Validation::showInput()
|
||||
*/
|
||||
PHP_METHOD(vtiful_validation, showInput)
|
||||
{
|
||||
zend_bool zb_show_input = 1;
|
||||
validation_object *obj = NULL;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(0, 1)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_BOOL(zb_show_input)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
obj = Z_VALIDATION_P(getThis());
|
||||
|
||||
if (obj->ptr.validation == NULL) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
if (zb_show_input) {
|
||||
obj->ptr.validation->show_input = LXW_VALIDATION_ON;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
obj->ptr.validation->show_input = LXW_VALIDATION_OFF;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Validation::showError()
|
||||
*/
|
||||
PHP_METHOD(vtiful_validation, showError)
|
||||
{
|
||||
zend_bool zb_show_error = 1;
|
||||
validation_object *obj = NULL;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(0, 1)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_BOOL(zb_show_error)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
obj = Z_VALIDATION_P(getThis());
|
||||
|
||||
if (obj->ptr.validation == NULL) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
if (zb_show_error) {
|
||||
obj->ptr.validation->show_error = LXW_VALIDATION_ON;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
obj->ptr.validation->show_error = LXW_VALIDATION_OFF;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Validation::errorType()
|
||||
*/
|
||||
PHP_METHOD(vtiful_validation, errorType)
|
||||
{
|
||||
zend_long zl_error_type = 0;
|
||||
validation_object *obj = NULL;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_LONG(zl_error_type)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
obj = Z_VALIDATION_P(getThis());
|
||||
|
||||
if (obj->ptr.validation == NULL) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
if (zl_error_type < LXW_VALIDATION_ERROR_TYPE_STOP || zl_error_type > LXW_VALIDATION_ERROR_TYPE_INFORMATION) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
obj->ptr.validation->error_type = zl_error_type;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Validation::dropdown()
|
||||
*/
|
||||
PHP_METHOD(vtiful_validation, dropdown)
|
||||
{
|
||||
zend_bool zb_dropdown = 1;
|
||||
validation_object *obj = NULL;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(0, 1)
|
||||
Z_PARAM_OPTIONAL
|
||||
Z_PARAM_BOOL(zb_dropdown)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
obj = Z_VALIDATION_P(getThis());
|
||||
|
||||
if (obj->ptr.validation == NULL) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
if (zb_dropdown) {
|
||||
obj->ptr.validation->dropdown = LXW_VALIDATION_ON;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
obj->ptr.validation->dropdown = LXW_VALIDATION_OFF;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Validation::valueNumber()
|
||||
*/
|
||||
PHP_METHOD(vtiful_validation, valueNumber)
|
||||
{
|
||||
zend_long zl_value_number = 0;
|
||||
validation_object *obj = NULL;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_LONG(zl_value_number)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
obj = Z_VALIDATION_P(getThis());
|
||||
|
||||
if (obj->ptr.validation == NULL) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
obj->ptr.validation->value_number = zl_value_number;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Validation::valueFormula()
|
||||
*/
|
||||
PHP_METHOD(vtiful_validation, valueFormula)
|
||||
{
|
||||
zend_string *zs_value_formula = NULL;
|
||||
validation_object *obj = NULL;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_STR(zs_value_formula)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
obj = Z_VALIDATION_P(getThis());
|
||||
|
||||
if (obj->ptr.validation == NULL) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
obj->ptr.validation->value_formula = ZSTR_VAL(zs_value_formula);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Validation::valueList()
|
||||
*/
|
||||
PHP_METHOD(vtiful_validation, valueList)
|
||||
{
|
||||
int index = 0;
|
||||
char **list = NULL;
|
||||
|
||||
zval *data;
|
||||
zval *zv_value_list = NULL;
|
||||
validation_object *obj = NULL;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_ARRAY(zv_value_list)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
obj = Z_VALIDATION_P(getThis());
|
||||
|
||||
if (obj->ptr.validation == NULL) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
if (obj->ptr.validation->value_list != NULL) {
|
||||
do {
|
||||
if (obj->ptr.validation->value_list[index] == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
efree(obj->ptr.validation->value_list[index]);
|
||||
index++;
|
||||
} while (1);
|
||||
|
||||
efree(obj->ptr.validation->value_list);
|
||||
obj->ptr.validation->value_list = NULL;
|
||||
}
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
zend_array *za_value_list = Z_ARR_P(zv_value_list);
|
||||
|
||||
ZEND_HASH_FOREACH_VAL(za_value_list, data) {
|
||||
if (Z_TYPE_P(data) != IS_STRING) {
|
||||
zend_throw_exception(vtiful_exception_ce, "Arrays can only consist of strings.", 300);
|
||||
return;
|
||||
}
|
||||
if (Z_STRLEN_P(data) == 0 ) {
|
||||
zend_throw_exception(vtiful_exception_ce, "Array value is empty string.", 301);
|
||||
return;
|
||||
}
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
|
||||
index = 0;
|
||||
list = ecalloc(za_value_list->nNumOfElements + 1, sizeof(char *));
|
||||
|
||||
ZEND_HASH_FOREACH_VAL(za_value_list, data) {
|
||||
list[index] = ecalloc(1, Z_STRLEN_P(data) + 1);
|
||||
strcpy(list[index], Z_STRVAL_P(data));
|
||||
index++;
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
|
||||
list[index] = NULL;
|
||||
|
||||
obj->ptr.validation->value_list = list;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Validation::valueDatetime(int $timestamp)
|
||||
*/
|
||||
PHP_METHOD(vtiful_validation, valueDatetime)
|
||||
{
|
||||
zend_long timestamp = 0;
|
||||
validation_object *obj = NULL;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_LONG(timestamp)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
obj = Z_VALIDATION_P(getThis());
|
||||
|
||||
if (obj->ptr.validation == NULL) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
obj->ptr.validation->value_datetime = timestamp_to_datetime(timestamp);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Validation::minimumNumber(double $minimumNumber)
|
||||
*/
|
||||
PHP_METHOD(vtiful_validation, minimumNumber)
|
||||
{
|
||||
double minimum_number = 0;
|
||||
validation_object *obj = NULL;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_DOUBLE(minimum_number)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
obj = Z_VALIDATION_P(getThis());
|
||||
|
||||
if (obj->ptr.validation == NULL) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
obj->ptr.validation->minimum_number = minimum_number;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Validation::minimumFormula()
|
||||
*/
|
||||
PHP_METHOD(vtiful_validation, minimumFormula)
|
||||
{
|
||||
zend_string *zs_minimum_formula = NULL;
|
||||
validation_object *obj = NULL;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_STR(zs_minimum_formula)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
obj = Z_VALIDATION_P(getThis());
|
||||
|
||||
if (obj->ptr.validation == NULL) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
obj->ptr.validation->minimum_formula = ZSTR_VAL(zs_minimum_formula);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Validation::minimumDatetime(int $timestamp)
|
||||
*/
|
||||
PHP_METHOD(vtiful_validation, minimumDatetime)
|
||||
{
|
||||
zend_long timestamp = 0;
|
||||
validation_object *obj = NULL;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_LONG(timestamp)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
obj = Z_VALIDATION_P(getThis());
|
||||
|
||||
if (obj->ptr.validation == NULL) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
obj->ptr.validation->minimum_datetime = timestamp_to_datetime(timestamp);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Validation::maximumNumber(double $maximumNumber)
|
||||
*/
|
||||
PHP_METHOD(vtiful_validation, maximumNumber)
|
||||
{
|
||||
double maximum_number = 0;
|
||||
validation_object *obj = NULL;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_DOUBLE(maximum_number)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
obj = Z_VALIDATION_P(getThis());
|
||||
|
||||
if (obj->ptr.validation == NULL) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
obj->ptr.validation->maximum_number = maximum_number;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Validation::maximumFormula()
|
||||
*/
|
||||
PHP_METHOD(vtiful_validation, maximumFormula)
|
||||
{
|
||||
zend_string *zs_maximum_formula = NULL;
|
||||
validation_object *obj = NULL;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_STR(zs_maximum_formula)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
obj = Z_VALIDATION_P(getThis());
|
||||
|
||||
if (obj->ptr.validation == NULL) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
obj->ptr.validation->maximum_formula = ZSTR_VAL(zs_maximum_formula);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Validation::maximumDatetime(int $timestamp)
|
||||
*/
|
||||
PHP_METHOD(vtiful_validation, maximumDatetime)
|
||||
{
|
||||
zend_long timestamp = 0;
|
||||
validation_object *obj = NULL;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_LONG(timestamp)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
obj = Z_VALIDATION_P(getThis());
|
||||
|
||||
if (obj->ptr.validation == NULL) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
obj->ptr.validation->maximum_datetime = timestamp_to_datetime(timestamp);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Validation::inputTitle()
|
||||
*/
|
||||
PHP_METHOD(vtiful_validation, inputTitle)
|
||||
{
|
||||
zend_string *zs_input_title = NULL;
|
||||
validation_object *obj = NULL;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_STR(zs_input_title)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
obj = Z_VALIDATION_P(getThis());
|
||||
|
||||
if (obj->ptr.validation == NULL) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
obj->ptr.validation->input_title = ZSTR_VAL(zs_input_title);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Validation::inputMessage()
|
||||
*/
|
||||
PHP_METHOD(vtiful_validation, inputMessage)
|
||||
{
|
||||
zend_string *zs_input_message = NULL;
|
||||
validation_object *obj = NULL;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_STR(zs_input_message)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
obj = Z_VALIDATION_P(getThis());
|
||||
|
||||
if (obj->ptr.validation == NULL) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
obj->ptr.validation->input_message = ZSTR_VAL(zs_input_message);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Validation::errorTitle()
|
||||
*/
|
||||
PHP_METHOD(vtiful_validation, errorTitle)
|
||||
{
|
||||
zend_string *zs_error_title = NULL;
|
||||
validation_object *obj = NULL;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_STR(zs_error_title)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
obj = Z_VALIDATION_P(getThis());
|
||||
|
||||
if (obj->ptr.validation == NULL) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
obj->ptr.validation->error_title = ZSTR_VAL(zs_error_title);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Validation::errorMessage()
|
||||
*/
|
||||
PHP_METHOD(vtiful_validation, errorMessage)
|
||||
{
|
||||
zend_string *zs_error_message = NULL;
|
||||
validation_object *obj = NULL;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
Z_PARAM_STR(zs_error_message)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
obj = Z_VALIDATION_P(getThis());
|
||||
|
||||
if (obj->ptr.validation == NULL) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
ZVAL_COPY(return_value, getThis());
|
||||
|
||||
obj->ptr.validation->error_message = ZSTR_VAL(zs_error_message);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ \Vtiful\Kernel\Validation::toResource()
|
||||
*/
|
||||
PHP_METHOD(vtiful_validation, toResource)
|
||||
{
|
||||
validation_object *obj = Z_VALIDATION_P(getThis());
|
||||
|
||||
RETURN_RES(zend_register_resource(obj->ptr.validation, le_xls_writer));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/** {{{ validation_methods
|
||||
*/
|
||||
zend_function_entry validation_methods[] = {
|
||||
PHP_ME(vtiful_validation, __construct, validation_construct_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_validation, validationType, validation_type_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_validation, criteriaType, validation_criteria_type_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_validation, ignoreBlank, validation_ignore_blank_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_validation, showInput, validation_show_input_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_validation, showError , validation_show_error_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_validation, errorType , validation_error_type_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_validation, dropdown , validation_dropdown_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_validation, valueNumber, validation_value_number_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_validation, valueFormula, validation_value_formula_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_validation, valueList, validation_value_list_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_validation, valueDatetime, validation_value_date_time_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_validation, minimumNumber, validation_minimum_number_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_validation, minimumFormula, validation_minimum_formula_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_validation, minimumDatetime, validation_minimum_datetime_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_validation, maximumNumber, validation_maximum_number_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_validation, maximumFormula, validation_maximum_formula_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_validation, maximumDatetime, validation_maximum_datetime_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_validation, inputTitle, validation_input_title_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_validation, inputMessage, validation_input_message_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_validation, errorTitle, validation_error_title_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_validation, errorMessage, validation_error_message_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_ME(vtiful_validation, toResource, validation_to_resource_arginfo, ZEND_ACC_PUBLIC)
|
||||
PHP_FE_END
|
||||
};
|
||||
/* }}} */
|
||||
|
||||
/** {{{ VTIFUL_STARTUP_FUNCTION
|
||||
*/
|
||||
VTIFUL_STARTUP_FUNCTION(validation) {
|
||||
zend_class_entry ce;
|
||||
|
||||
INIT_NS_CLASS_ENTRY(ce, "Vtiful\\Kernel", "Validation", validation_methods);
|
||||
ce.create_object = validation_objects_new;
|
||||
vtiful_validation_ce = zend_register_internal_class(&ce);
|
||||
|
||||
memcpy(&validation_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
|
||||
validation_handlers.offset = XtOffsetOf(validation_object, zo);
|
||||
validation_handlers.free_obj = validation_objects_free;
|
||||
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "TYPE_INTEGER", LXW_VALIDATION_TYPE_INTEGER)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "TYPE_INTEGER_FORMULA", LXW_VALIDATION_TYPE_INTEGER_FORMULA)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "TYPE_DECIMAL", LXW_VALIDATION_TYPE_DECIMAL)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "TYPE_DECIMAL_FORMULA", LXW_VALIDATION_TYPE_DECIMAL_FORMULA)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "TYPE_LIST", LXW_VALIDATION_TYPE_LIST)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "TYPE_LIST_FORMULA", LXW_VALIDATION_TYPE_LIST_FORMULA)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "TYPE_DATE", LXW_VALIDATION_TYPE_DATE)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "TYPE_DATE_FORMULA", LXW_VALIDATION_TYPE_DATE_FORMULA)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "TYPE_DATE_NUMBER", LXW_VALIDATION_TYPE_DATE_NUMBER)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "TYPE_TIME", LXW_VALIDATION_TYPE_TIME)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "TYPE_TIME_FORMULA", LXW_VALIDATION_TYPE_TIME_FORMULA)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "TYPE_TIME_NUMBER", LXW_VALIDATION_TYPE_TIME_NUMBER)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "TYPE_LENGTH", LXW_VALIDATION_TYPE_LENGTH)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "TYPE_LENGTH_FORMULA", LXW_VALIDATION_TYPE_LENGTH_FORMULA)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "TYPE_CUSTOM_FORMULA", LXW_VALIDATION_TYPE_CUSTOM_FORMULA)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "TYPE_ANY", LXW_VALIDATION_TYPE_ANY)
|
||||
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "CRITERIA_BETWEEN", LXW_VALIDATION_CRITERIA_BETWEEN)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "CRITERIA_NOT_BETWEEN", LXW_VALIDATION_CRITERIA_NOT_BETWEEN)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "CRITERIA_EQUAL_TO", LXW_VALIDATION_CRITERIA_EQUAL_TO)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "CRITERIA_NOT_EQUAL_TO", LXW_VALIDATION_CRITERIA_NOT_EQUAL_TO)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "CRITERIA_GREATER_THAN", LXW_VALIDATION_CRITERIA_GREATER_THAN)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "CRITERIA_LESS_THAN", LXW_VALIDATION_CRITERIA_LESS_THAN)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "CRITERIA_GREATER_THAN_OR_EQUAL_TO", LXW_VALIDATION_CRITERIA_GREATER_THAN_OR_EQUAL_TO)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "CRITERIA_LESS_THAN_OR_EQUAL_TO", LXW_VALIDATION_CRITERIA_LESS_THAN_OR_EQUAL_TO)
|
||||
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "ERROR_TYPE_STOP", LXW_VALIDATION_ERROR_TYPE_STOP)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "ERROR_TYPE_WARNING", LXW_VALIDATION_ERROR_TYPE_WARNING)
|
||||
REGISTER_CLASS_CONST_LONG(vtiful_validation_ce, "ERROR_TYPE_INFORMATION", LXW_VALIDATION_ERROR_TYPE_INFORMATION)
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
121
kernel/validation.dep
Normal file
121
kernel/validation.dep
Normal file
@ -0,0 +1,121 @@
|
||||
kernel/validation.lo: \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/kernel/validation.c \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/xlswriter.h \
|
||||
config.h /usr/local/etc/php/include/php/main/php.h \
|
||||
/usr/local/etc/php/include/php/main/php_version.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_types.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_portability.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_config.h \
|
||||
/usr/local/etc/php/include/php/main/../main/php_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/../TSRM/TSRM.h \
|
||||
/usr/local/etc/php/include/php/main/php_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_range_check.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_long.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_map_ptr.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_errors.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_alloc.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_alloc_sizes.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_llist.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_string.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_hash.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_sort.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ast.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_gc.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_hrtime.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_variables.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_iterators.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_stream.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_str_public.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_string_public.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_signal.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_max_execution_timer.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_object_handlers.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_operators.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_strtod.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_multiply.h \
|
||||
/usr/local/etc/php/include/php/main/php_compat.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_API.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_modules.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_compile.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_globals.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_globals_macros.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_atomic.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ptr_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_objects.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_objects_API.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_float.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_multibyte.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_arena.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_call_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_vm_opcodes.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_build.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_list.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_execute.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_type_info.h \
|
||||
/usr/local/etc/php/include/php/main/build-defs.h \
|
||||
/usr/local/etc/php/include/php/main/snprintf.h \
|
||||
/usr/local/etc/php/include/php/main/spprintf.h \
|
||||
/usr/local/etc/php/include/php/main/php_syslog.h \
|
||||
/usr/local/etc/php/include/php/main/php_output.h \
|
||||
/usr/local/etc/php/include/php/main/php_streams.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_context.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_filter_api.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_transport.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_plain_wrapper.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_glob_wrapper.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_userspace.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_mmap.h \
|
||||
/usr/local/etc/php/include/php/main/php_memory_streams.h \
|
||||
/usr/local/etc/php/include/php/main/fopen_wrappers.h \
|
||||
/usr/local/etc/php/include/php/main/php_globals.h \
|
||||
/usr/local/etc/php/include/php/main/php_ini.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ini.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_virtual_cwd.h \
|
||||
/usr/local/etc/php/include/php/TSRM/TSRM.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_constants.h \
|
||||
/usr/local/etc/php/include/php/main/php_reentrancy.h \
|
||||
/usr/local/etc/php/include/php/ext/date/php_date.h \
|
||||
/usr/local/etc/php/include/php/ext/date/lib/timelib.h \
|
||||
/usr/local/etc/php/include/php/ext/date/lib/timelib_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_str.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_exceptions.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/workbook.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/worksheet.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/shared_strings.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/common.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/queue.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/tree.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/chart.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/format.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/hash_table.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/drawing.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/styles.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/utility.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/xmlwriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/relationships.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/chartsheet.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/packager.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/zip.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/app.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/core.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/custom.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/theme.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/content_types.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/vml.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/comment.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/metadata.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/common.h \
|
||||
php_xlswriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/excel.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/validation.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/exception.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/format.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/chart.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/rich_string.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/help.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxio/include/xlsxio_read.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/read.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/csv.h
|
1231
kernel/write.c
Normal file
1231
kernel/write.c
Normal file
File diff suppressed because it is too large
Load Diff
121
kernel/write.dep
Normal file
121
kernel/write.dep
Normal file
@ -0,0 +1,121 @@
|
||||
kernel/write.lo: \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/kernel/write.c \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/xlswriter.h \
|
||||
config.h /usr/local/etc/php/include/php/main/php.h \
|
||||
/usr/local/etc/php/include/php/main/php_version.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_types.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_portability.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_config.h \
|
||||
/usr/local/etc/php/include/php/main/../main/php_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/../TSRM/TSRM.h \
|
||||
/usr/local/etc/php/include/php/main/php_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_range_check.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_long.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_map_ptr.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_errors.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_alloc.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_alloc_sizes.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_llist.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_string.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_hash.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_sort.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ast.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_gc.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_hrtime.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_variables.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_iterators.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_stream.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_str_public.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_string_public.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_signal.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_max_execution_timer.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_object_handlers.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_operators.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_strtod.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_multiply.h \
|
||||
/usr/local/etc/php/include/php/main/php_compat.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_API.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_modules.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_compile.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_globals.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_globals_macros.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_atomic.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ptr_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_objects.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_objects_API.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_float.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_multibyte.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_arena.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_call_stack.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_vm_opcodes.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_build.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_list.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_execute.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_type_info.h \
|
||||
/usr/local/etc/php/include/php/main/build-defs.h \
|
||||
/usr/local/etc/php/include/php/main/snprintf.h \
|
||||
/usr/local/etc/php/include/php/main/spprintf.h \
|
||||
/usr/local/etc/php/include/php/main/php_syslog.h \
|
||||
/usr/local/etc/php/include/php/main/php_output.h \
|
||||
/usr/local/etc/php/include/php/main/php_streams.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_context.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_filter_api.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_transport.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_plain_wrapper.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_glob_wrapper.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_userspace.h \
|
||||
/usr/local/etc/php/include/php/main/streams/php_stream_mmap.h \
|
||||
/usr/local/etc/php/include/php/main/php_memory_streams.h \
|
||||
/usr/local/etc/php/include/php/main/fopen_wrappers.h \
|
||||
/usr/local/etc/php/include/php/main/php_globals.h \
|
||||
/usr/local/etc/php/include/php/main/php_ini.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_ini.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_virtual_cwd.h \
|
||||
/usr/local/etc/php/include/php/TSRM/TSRM.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_constants.h \
|
||||
/usr/local/etc/php/include/php/main/php_reentrancy.h \
|
||||
/usr/local/etc/php/include/php/ext/date/php_date.h \
|
||||
/usr/local/etc/php/include/php/ext/date/lib/timelib.h \
|
||||
/usr/local/etc/php/include/php/ext/date/lib/timelib_config.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_smart_str.h \
|
||||
/usr/local/etc/php/include/php/Zend/zend_exceptions.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/workbook.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/worksheet.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/shared_strings.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/common.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/queue.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/tree.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/chart.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/format.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/hash_table.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/drawing.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/styles.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/utility.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/xmlwriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/relationships.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/chartsheet.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/packager.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/third_party/zip.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/app.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/core.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/custom.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/theme.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/content_types.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/vml.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/comment.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxwriter/include/xlsxwriter/metadata.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/common.h \
|
||||
php_xlswriter.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/excel.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/validation.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/exception.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/format.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/chart.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/rich_string.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/help.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/library/libxlsxio/include/xlsxio_read.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/read.h \
|
||||
/Users/ykxiao/nginx/www/phpext/php-ext-xlswriter/include/csv.h
|
Reference in New Issue
Block a user