|
| 1 | +/* |
| 2 | + +----------------------------------------------------------------------+ |
| 3 | + | PHP Version 7 | |
| 4 | + +----------------------------------------------------------------------+ |
| 5 | + | Copyright (c) 1997-2017 The PHP Group | |
| 6 | + +----------------------------------------------------------------------+ |
| 7 | + | This source file is subject to version 3.01 of the PHP license, | |
| 8 | + | that is bundled with this package in the file LICENSE, and is | |
| 9 | + | available through the world-wide-web at the following url: | |
| 10 | + | http://www.php.net/license/3_01.txt | |
| 11 | + | If you did not receive a copy of the PHP license and are unable to | |
| 12 | + | obtain it through the world-wide-web, please send a note to | |
| 13 | + | license@php.net so we can mail you a copy immediately. | |
| 14 | + +----------------------------------------------------------------------+ |
| 15 | + | Author: | |
| 16 | + +----------------------------------------------------------------------+ |
| 17 | +*/ |
| 18 | + |
| 19 | +/* $Id$ */ |
| 20 | + |
| 21 | +#ifdef HAVE_CONFIG_H |
| 22 | +#include "config.h" |
| 23 | +#endif |
| 24 | + |
| 25 | +#include "php.h" |
| 26 | +#include "php_ini.h" |
| 27 | +#include "ext/standard/info.h" |
| 28 | +#include "php_opencv.h" |
| 29 | + |
| 30 | +/* If you declare any globals in php_opencv.h uncomment this: |
| 31 | +ZEND_DECLARE_MODULE_GLOBALS(opencv) |
| 32 | +*/ |
| 33 | + |
| 34 | +/* True global resources - no need for thread safety here */ |
| 35 | +static int le_opencv; |
| 36 | + |
| 37 | +/* {{{ PHP_INI |
| 38 | + */ |
| 39 | +/* Remove comments and fill if you need to have entries in php.ini |
| 40 | +PHP_INI_BEGIN() |
| 41 | + STD_PHP_INI_ENTRY("opencv.global_value", "42", PHP_INI_ALL, OnUpdateLong, global_value, zend_opencv_globals, opencv_globals) |
| 42 | + STD_PHP_INI_ENTRY("opencv.global_string", "foobar", PHP_INI_ALL, OnUpdateString, global_string, zend_opencv_globals, opencv_globals) |
| 43 | +PHP_INI_END() |
| 44 | +*/ |
| 45 | +/* }}} */ |
| 46 | + |
| 47 | +/* Remove the following function when you have successfully modified config.m4 |
| 48 | + so that your module can be compiled into PHP, it exists only for testing |
| 49 | + purposes. */ |
| 50 | + |
| 51 | +/* Every user-visible function in PHP should document itself in the source */ |
| 52 | +/* {{{ proto string confirm_opencv_compiled(string arg) |
| 53 | + Return a string to confirm that the module is compiled in */ |
| 54 | +PHP_FUNCTION(confirm_opencv_compiled) |
| 55 | +{ |
| 56 | + char *arg = NULL; |
| 57 | + size_t arg_len, len; |
| 58 | + zend_string *strg; |
| 59 | + |
| 60 | + if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &arg, &arg_len) == FAILURE) { |
| 61 | + return; |
| 62 | + } |
| 63 | + |
| 64 | + strg = strpprintf(0, "Congratulations! You have successfully modified ext/%.78s/config.m4. Module %.78s is now compiled into PHP.", "opencv", arg); |
| 65 | + |
| 66 | + RETURN_STR(strg); |
| 67 | +} |
| 68 | +/* }}} */ |
| 69 | +/* The previous line is meant for vim and emacs, so it can correctly fold and |
| 70 | + unfold functions in source code. See the corresponding marks just before |
| 71 | + function definition, where the functions purpose is also documented. Please |
| 72 | + follow this convention for the convenience of others editing your code. |
| 73 | +*/ |
| 74 | + |
| 75 | + |
| 76 | +/* {{{ php_opencv_init_globals |
| 77 | + */ |
| 78 | +/* Uncomment this function if you have INI entries |
| 79 | +static void php_opencv_init_globals(zend_opencv_globals *opencv_globals) |
| 80 | +{ |
| 81 | + opencv_globals->global_value = 0; |
| 82 | + opencv_globals->global_string = NULL; |
| 83 | +} |
| 84 | +*/ |
| 85 | +/* }}} */ |
| 86 | + |
| 87 | +/* {{{ PHP_MINIT_FUNCTION |
| 88 | + */ |
| 89 | +PHP_MINIT_FUNCTION(opencv) |
| 90 | +{ |
| 91 | + /* If you have INI entries, uncomment these lines |
| 92 | + REGISTER_INI_ENTRIES(); |
| 93 | + */ |
| 94 | + return SUCCESS; |
| 95 | +} |
| 96 | +/* }}} */ |
| 97 | + |
| 98 | +/* {{{ PHP_MSHUTDOWN_FUNCTION |
| 99 | + */ |
| 100 | +PHP_MSHUTDOWN_FUNCTION(opencv) |
| 101 | +{ |
| 102 | + /* uncomment this line if you have INI entries |
| 103 | + UNREGISTER_INI_ENTRIES(); |
| 104 | + */ |
| 105 | + return SUCCESS; |
| 106 | +} |
| 107 | +/* }}} */ |
| 108 | + |
| 109 | +/* Remove if there's nothing to do at request start */ |
| 110 | +/* {{{ PHP_RINIT_FUNCTION |
| 111 | + */ |
| 112 | +PHP_RINIT_FUNCTION(opencv) |
| 113 | +{ |
| 114 | +#if defined(COMPILE_DL_OPENCV) && defined(ZTS) |
| 115 | + ZEND_TSRMLS_CACHE_UPDATE(); |
| 116 | +#endif |
| 117 | + return SUCCESS; |
| 118 | +} |
| 119 | +/* }}} */ |
| 120 | + |
| 121 | +/* Remove if there's nothing to do at request end */ |
| 122 | +/* {{{ PHP_RSHUTDOWN_FUNCTION |
| 123 | + */ |
| 124 | +PHP_RSHUTDOWN_FUNCTION(opencv) |
| 125 | +{ |
| 126 | + return SUCCESS; |
| 127 | +} |
| 128 | +/* }}} */ |
| 129 | + |
| 130 | +/* {{{ PHP_MINFO_FUNCTION |
| 131 | + */ |
| 132 | +PHP_MINFO_FUNCTION(opencv) |
| 133 | +{ |
| 134 | + php_info_print_table_start(); |
| 135 | + php_info_print_table_header(2, "opencv support", "enabled"); |
| 136 | + php_info_print_table_end(); |
| 137 | + |
| 138 | + /* Remove comments if you have entries in php.ini |
| 139 | + DISPLAY_INI_ENTRIES(); |
| 140 | + */ |
| 141 | +} |
| 142 | +/* }}} */ |
| 143 | + |
| 144 | +/* {{{ opencv_functions[] |
| 145 | + * |
| 146 | + * Every user visible function must have an entry in opencv_functions[]. |
| 147 | + */ |
| 148 | +const zend_function_entry opencv_functions[] = { |
| 149 | + PHP_FE(confirm_opencv_compiled, NULL) /* For testing, remove later. */ |
| 150 | + PHP_FE_END /* Must be the last line in opencv_functions[] */ |
| 151 | +}; |
| 152 | +/* }}} */ |
| 153 | + |
| 154 | +/* {{{ opencv_module_entry |
| 155 | + */ |
| 156 | +zend_module_entry opencv_module_entry = { |
| 157 | + STANDARD_MODULE_HEADER, |
| 158 | + "opencv", |
| 159 | + opencv_functions, |
| 160 | + PHP_MINIT(opencv), |
| 161 | + PHP_MSHUTDOWN(opencv), |
| 162 | + PHP_RINIT(opencv), /* Replace with NULL if there's nothing to do at request start */ |
| 163 | + PHP_RSHUTDOWN(opencv), /* Replace with NULL if there's nothing to do at request end */ |
| 164 | + PHP_MINFO(opencv), |
| 165 | + PHP_OPENCV_VERSION, |
| 166 | + STANDARD_MODULE_PROPERTIES |
| 167 | +}; |
| 168 | +/* }}} */ |
| 169 | + |
| 170 | +#ifdef COMPILE_DL_OPENCV |
| 171 | +#ifdef ZTS |
| 172 | +ZEND_TSRMLS_CACHE_DEFINE() |
| 173 | +#endif |
| 174 | +ZEND_GET_MODULE(opencv) |
| 175 | +#endif |
| 176 | + |
| 177 | +/* |
| 178 | + * Local variables: |
| 179 | + * tab-width: 4 |
| 180 | + * c-basic-offset: 4 |
| 181 | + * End: |
| 182 | + * vim600: noet sw=4 ts=4 fdm=marker |
| 183 | + * vim<600: noet sw=4 ts=4 |
| 184 | + */ |
0 commit comments