cpp文件调整

Esse commit está contido em:
midoks
2017-09-17 19:38:21 +08:00
commit 33a64badec
6 arquivos alterados com 139 adições e 21 exclusões
+8 -3
Ver Arquivo
@@ -80,10 +80,15 @@ if test "$PHP_OPENCV" != "no"; then
done
PHP_ADD_LIBRARY(stdc++,"",OPENCV_SHARED_LIBADD)
PHP_SUBST(OPENCV_SHARED_LIBADD)
PHP_REQUIRE_CXX()
PHP_NEW_EXTENSION(opencv,
opencv.c \
demo.c \
lib/imgproc.c,
opencv.cpp \
lib/demo.cpp \
lib/imgproc.cpp,
$ext_shared)
PHP_ADD_BUILD_DIR([$ext_builddir/lib])
+12 -8
Ver Arquivo
@@ -18,14 +18,18 @@
/* $Id$ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
extern "C"{
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "php.h"
#include "php_ini.h"
#include "ext/standard/info.h"
#include "ext/standard/php_var.h"
#include "php_opencv.h"
}
#include "php.h"
#include "php_ini.h"
#include "ext/standard/info.h"
#include "php_opencv.h"
zend_class_entry * opencv_demo_ce;
zend_class_entry * opencv_demo_ce_ns;
@@ -43,7 +47,7 @@ PHP_METHOD(opencv_demo, __construct) {
/** {{{ opencv_imgproc_methods
*/
zend_function_entry opencv_demo_methods[] = {
PHP_ME(opencv_imgproc, __construct, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
PHP_ME(opencv_demo, __construct, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
{NULL, NULL, NULL}
};
/* }}} */
+97
Ver Arquivo
@@ -0,0 +1,97 @@
/*
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2017 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: midoks |
+----------------------------------------------------------------------+
*/
/* $Id$ */
extern "C"{
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "php.h"
#include "php_ini.h"
#include "ext/standard/info.h"
#include "ext/standard/php_var.h"
#include "php_opencv.h"
}
zend_class_entry * opencv_imgproc_ce;
zend_class_entry * opencv_imgproc_ce_ns;
ZEND_BEGIN_ARG_INFO_EX(opencv_imgproc_void_arginfo, 0, 0, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(opencv_imgproc_construct_arginfo, 0, 0, 0)
ZEND_ARG_INFO(0, source)
ZEND_END_ARG_INFO()
/** {{{ proto OpenCV_ImgProc::__construct(string $source)
*/
PHP_METHOD(opencv_imgproc, __construct) {
zval *source = NULL;
if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "|z", &source) == FAILURE) {
return;
}
if (source){
php_var_dump(source, 1);
php_printf("hello world!!--!\n");
}
}
/* }}} */
/** {{{ opencv_imgproc_methods
*/
zend_function_entry opencv_imgproc_methods[] = {
PHP_ME(opencv_imgproc, __construct, opencv_imgproc_construct_arginfo, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
{NULL, NULL, NULL}
};
/* }}} */
/** {{{ OPENCV_STARTUP_FUNCTION
*/
OPENCV_STARTUP_FUNCTION(imgproc) {
zend_class_entry ce;
zend_class_entry ce_ns;
OPENCV_INIT_CLASS_ENTRY(ce, ce_ns, "OpenCV_ImgProc", "OpenCV\\ImgProc", opencv_imgproc_methods);
opencv_imgproc_ce = zend_register_internal_class_ex(&ce, NULL);
opencv_imgproc_ce_ns = zend_register_internal_class_ex(&ce_ns, NULL);
opencv_imgproc_ce->ce_flags |= ZEND_ACC_FINAL;
opencv_imgproc_ce_ns->ce_flags |= ZEND_ACC_FINAL;
return SUCCESS;
}
/* }}} */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/
Ver Arquivo
+14 -8
Ver Arquivo
@@ -18,17 +18,21 @@
/* $Id$ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
extern "C" {
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "php.h"
#include "php_ini.h"
#include "ext/standard/info.h"
#include "php_opencv.h"
#include "php.h"
#include "php_ini.h"
#include "ext/standard/info.h"
#include "ext/standard/php_var.h"
#include "php_opencv.h"
}
#include "opencv2/core/version.hpp"
/* If you declare any globals in php_opencv.h uncomment this:
ZEND_DECLARE_MODULE_GLOBALS(opencv)
*/
@@ -94,8 +98,9 @@ PHP_MINIT_FUNCTION(opencv)
REGISTER_INI_ENTRIES();
*/
OPENCV_STARTUP(imgproc);
OPENCV_STARTUP(demo);
OPENCV_STARTUP(imgproc);
return SUCCESS;
}
/* }}} */
@@ -140,6 +145,7 @@ PHP_MINFO_FUNCTION(opencv)
php_info_print_table_header(2, "opencv support", "enabled");
php_info_print_table_row(2, "OpenCV version", CV_VERSION);
php_info_print_table_row(2, "PHP_OPENCV_VERSION", PHP_OPENCV_VERSION);
php_info_print_table_row(2, "Supports", PHP_OPENCV_SOURCE_URL);
php_info_print_table_end();
}
/* }}} */
+8 -2
Ver Arquivo
@@ -25,6 +25,7 @@ extern zend_module_entry opencv_module_entry;
#define phpext_opencv_ptr &opencv_module_entry
#define PHP_OPENCV_VERSION "0.1.0"
#define PHP_OPENCV_SOURCE_URL "https://github.com/midoks/opencv"
#ifdef PHP_WIN32
# define PHP_OPENCV_API __declspec(dllexport)
@@ -49,8 +50,8 @@ extern zend_module_entry opencv_module_entry;
INIT_CLASS_ENTRY(ce, name, methods); \
INIT_CLASS_ENTRY(ce_ns, name_ns, methods);
extern PHPAPI void php_var_dump(zval **struc, int level);
extern PHPAPI void php_debug_zval_dump(zval **struc, int level);
//extern PHPAPI void php_var_dump(zval **struc, int level);
//extern PHPAPI void php_debug_zval_dump(zval **struc, int level);
/*
Declare any global variables you may need between the BEGIN
@@ -72,6 +73,11 @@ ZEND_END_MODULE_GLOBALS(opencv)
ZEND_TSRMLS_CACHE_EXTERN()
#endif
OPENCV_STARTUP_FUNCTION(demo);
OPENCV_STARTUP_FUNCTION(imgproc);
#endif /* PHP_OPENCV_H */