| 1 |
/* |
| 2 |
+----------------------------------------------------------------------+ |
| 3 |
| unknown license: | |
| 4 |
+----------------------------------------------------------------------+ |
| 5 |
| Authors: yu <[email protected]> | |
| 6 |
+----------------------------------------------------------------------+ |
| 7 |
*/ |
| 8 |
|
| 9 |
#ifndef PHP_GROONGA_H |
| 10 |
#define PHP_GROONGA_H |
| 11 |
|
| 12 |
#ifdef __cplusplus |
| 13 |
extern "C" { |
| 14 |
#endif |
| 15 |
|
| 16 |
#ifdef HAVE_CONFIG_H |
| 17 |
#include "config.h" |
| 18 |
#endif |
| 19 |
|
| 20 |
#include <php.h> |
| 21 |
|
| 22 |
#ifdef HAVE_GROONGA |
| 23 |
|
| 24 |
#include <php_ini.h> |
| 25 |
#include <SAPI.h> |
| 26 |
#include <ext/standard/info.h> |
| 27 |
#include <Zend/zend_extensions.h> |
| 28 |
#ifdef __cplusplus |
| 29 |
} // extern "C" |
| 30 |
#endif |
| 31 |
#include <groonga.h> |
| 32 |
#ifdef __cplusplus |
| 33 |
extern "C" { |
| 34 |
#endif |
| 35 |
|
| 36 |
extern zend_module_entry groonga_module_entry; |
| 37 |
#define phpext_groonga_ptr &groonga_module_entry |
| 38 |
|
| 39 |
#ifdef PHP_WIN32 |
| 40 |
#define PHP_GROONGA_API __declspec(dllexport) |
| 41 |
#else |
| 42 |
#define PHP_GROONGA_API |
| 43 |
#endif |
| 44 |
|
| 45 |
PHP_MINIT_FUNCTION(groonga); |
| 46 |
PHP_MSHUTDOWN_FUNCTION(groonga); |
| 47 |
PHP_RINIT_FUNCTION(groonga); |
| 48 |
PHP_RSHUTDOWN_FUNCTION(groonga); |
| 49 |
PHP_MINFO_FUNCTION(groonga); |
| 50 |
|
| 51 |
#ifdef ZTS |
| 52 |
#include "TSRM.h" |
| 53 |
#endif |
| 54 |
|
| 55 |
#define FREE_RESOURCE(resource) zend_list_delete(Z_LVAL_P(resource)) |
| 56 |
|
| 57 |
#define PROP_GET_LONG(name) Z_LVAL_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC)) |
| 58 |
#define PROP_SET_LONG(name, l) zend_update_property_long(_this_ce, _this_zval, #name, strlen(#name), l TSRMLS_CC) |
| 59 |
|
| 60 |
#define PROP_GET_DOUBLE(name) Z_DVAL_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC)) |
| 61 |
#define PROP_SET_DOUBLE(name, d) zend_update_property_double(_this_ce, _this_zval, #name, strlen(#name), d TSRMLS_CC) |
| 62 |
|
| 63 |
#define PROP_GET_STRING(name) Z_STRVAL_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC)) |
| 64 |
#define PROP_GET_STRLEN(name) Z_STRLEN_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC)) |
| 65 |
#define PROP_SET_STRING(name, s) zend_update_property_string(_this_ce, _this_zval, #name, strlen(#name), s TSRMLS_CC) |
| 66 |
#define PROP_SET_STRINGL(name, s, l) zend_update_property_stringl(_this_ce, _this_zval, #name, strlen(#name), s, l TSRMLS_CC) |
| 67 |
|
| 68 |
|
| 69 |
PHP_FUNCTION(grn_ctx_init); |
| 70 |
#if (PHP_MAJOR_VERSION >= 5) |
| 71 |
ZEND_BEGIN_ARG_INFO_EX(grn_ctx_init_arg_info, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) |
| 72 |
ZEND_ARG_INFO(0, flags) |
| 73 |
ZEND_END_ARG_INFO() |
| 74 |
#else /* PHP 4.x */ |
| 75 |
#define grn_ctx_init_arg_info NULL |
| 76 |
#endif |
| 77 |
|
| 78 |
PHP_FUNCTION(grn_ctx_close); |
| 79 |
#if (PHP_MAJOR_VERSION >= 5) |
| 80 |
ZEND_BEGIN_ARG_INFO_EX(grn_ctx_close_arg_info, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) |
| 81 |
ZEND_ARG_INFO(0, res) |
| 82 |
ZEND_END_ARG_INFO() |
| 83 |
#else /* PHP 4.x */ |
| 84 |
#define grn_ctx_close_arg_info NULL |
| 85 |
#endif |
| 86 |
|
| 87 |
PHP_FUNCTION(grn_ctx_connect); |
| 88 |
#if (PHP_MAJOR_VERSION >= 5) |
| 89 |
ZEND_BEGIN_ARG_INFO_EX(grn_ctx_connect_arg_info, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 4) |
| 90 |
ZEND_ARG_INFO(0, res) |
| 91 |
ZEND_ARG_INFO(0, host) |
| 92 |
ZEND_ARG_INFO(0, port) |
| 93 |
ZEND_ARG_INFO(0, flags) |
| 94 |
ZEND_END_ARG_INFO() |
| 95 |
#else /* PHP 4.x */ |
| 96 |
#define grn_ctx_connect_arg_info NULL |
| 97 |
#endif |
| 98 |
|
| 99 |
PHP_FUNCTION(grn_ctx_send); |
| 100 |
#if (PHP_MAJOR_VERSION >= 5) |
| 101 |
ZEND_BEGIN_ARG_INFO_EX(grn_ctx_send_arg_info, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 3) |
| 102 |
ZEND_ARG_INFO(0, res) |
| 103 |
ZEND_ARG_INFO(0, query) |
| 104 |
ZEND_ARG_INFO(0, flags) |
| 105 |
ZEND_END_ARG_INFO() |
| 106 |
#else /* PHP 4.x */ |
| 107 |
#define grn_ctx_send_arg_info NULL |
| 108 |
#endif |
| 109 |
|
| 110 |
PHP_FUNCTION(grn_ctx_recv); |
| 111 |
#if (PHP_MAJOR_VERSION >= 5) |
| 112 |
ZEND_BEGIN_ARG_INFO_EX(grn_ctx_recv_arg_info, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) |
| 113 |
ZEND_ARG_INFO(0, res) |
| 114 |
ZEND_END_ARG_INFO() |
| 115 |
#else /* PHP 4.x */ |
| 116 |
#define grn_ctx_recv_arg_info NULL |
| 117 |
#endif |
| 118 |
|
| 119 |
#ifdef __cplusplus |
| 120 |
} // extern "C" |
| 121 |
#endif |
| 122 |
|
| 123 |
#endif /* PHP_HAVE_GROONGA */ |
| 124 |
|
| 125 |
#endif /* PHP_GROONGA_H */ |