/*
   +----------------------------------------------------------------------+
   | All rights reserved                                                  |
   |                                                                      |
   | Redistribution and use in source and binary forms, with or without   |
   | modification, are permitted provided that the following conditions   |
   | are met:                                                             |
   |                                                                      |
   | 1. Redistributions of source code must retain the above copyright    |
   |    notice, this list of conditions and the following disclaimer.     |
   | 2. Redistributions in binary form must reproduce the above copyright |
   |    notice, this list of conditions and the following disclaimer in   |
   |    the documentation and/or other materials provided with the        |
   |    distribution.                                                     |
   | 3. The names of the authors may not be used to endorse or promote    |
   |    products derived from this software without specific prior        |
   |    written permission.                                               |
   |                                                                      |
   | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  |
   | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT    |
   | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS    |
   | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE       |
   | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,  |
   | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
   | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;     |
   | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER     |
   | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT   |
   | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN    | 
   | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE      |
   | POSSIBILITY OF SUCH DAMAGE.                                          |
   +----------------------------------------------------------------------+
   | Authors: rsk <rsky0711@gmail.com>                                    |
   +----------------------------------------------------------------------+
*/

/* $ Id: $ */ 

#ifndef PHP_MECAB_H
#define PHP_MECAB_H

#ifdef  __cplusplus
extern "C" {
#endif

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <php.h>

#include <php_ini.h>
#include <SAPI.h>
#include <ext/standard/info.h>
#include <Zend/zend_extensions.h>
#ifdef HAVE_SPL
#include <Zend/zend_interfaces.h>
#endif
#ifdef  __cplusplus
} // extern "C" 
#endif
#include <mecab.h>
#ifdef  __cplusplus
extern "C" {
#endif

extern zend_module_entry mecab_module_entry;
#define phpext_mecab_ptr &mecab_module_entry

#ifdef PHP_WIN32
#define PHP_MECAB_API __declspec(dllexport)
#else
#define PHP_MECAB_API
#endif

PHP_MINIT_FUNCTION(mecab);
PHP_MSHUTDOWN_FUNCTION(mecab);
PHP_RINIT_FUNCTION(mecab);
PHP_RSHUTDOWN_FUNCTION(mecab);
PHP_MINFO_FUNCTION(mecab);

#ifdef ZTS
#include "TSRM.h"
#endif

#define FREE_RESOURCE(resource) zend_list_delete(Z_LVAL_P(resource))

/* MeCab API wrappers */
PHP_FUNCTION(mecab_new);
PHP_FUNCTION(mecab_destroy);
PHP_FUNCTION(mecab_sparse_tostr);
PHP_FUNCTION(mecab_sparse_tonode);
PHP_FUNCTION(mecab_nbest_sparse_tostr);
PHP_FUNCTION(mecab_nbest_init);
PHP_FUNCTION(mecab_nbest_next_tostr);
PHP_FUNCTION(mecab_nbest_next_tonode);
PHP_FUNCTION(mecab_format_node);
/* Dumper for mecab_node */
PHP_FUNCTION(mecab_node_toarray);
/* Iterator implementations for mecab_node */
PHP_FUNCTION(mecab_node_current);
PHP_FUNCTION(mecab_node_key);
PHP_FUNCTION(mecab_node_valid);
PHP_FUNCTION(mecab_node_rewind);
PHP_FUNCTION(mecab_node_next);
/* Getters for mecab_node */
PHP_FUNCTION(mecab_node_get_prev);
PHP_FUNCTION(mecab_node_get_next);
PHP_FUNCTION(mecab_node_get_enext);
PHP_FUNCTION(mecab_node_get_bnext);
PHP_FUNCTION(mecab_node_get_rpath);
PHP_FUNCTION(mecab_node_get_lpath);
PHP_FUNCTION(mecab_node_get_surface);
PHP_FUNCTION(mecab_node_get_feature);
PHP_FUNCTION(mecab_node_get_id);
PHP_FUNCTION(mecab_node_get_length);
PHP_FUNCTION(mecab_node_get_rlength);
PHP_FUNCTION(mecab_node_get_rcattr);
PHP_FUNCTION(mecab_node_get_lcattr);
PHP_FUNCTION(mecab_node_get_posid);
PHP_FUNCTION(mecab_node_get_char_type);
PHP_FUNCTION(mecab_node_get_stat);
PHP_FUNCTION(mecab_node_get_isbest);
PHP_FUNCTION(mecab_node_get_alpha);
PHP_FUNCTION(mecab_node_get_beta);
PHP_FUNCTION(mecab_node_get_prob);
PHP_FUNCTION(mecab_node_get_wcost);
PHP_FUNCTION(mecab_node_get_cost);
/* Getters for mecab_path */
PHP_FUNCTION(mecab_path_get_rnext);
PHP_FUNCTION(mecab_path_get_lnext);
PHP_FUNCTION(mecab_path_get_rnode);
PHP_FUNCTION(mecab_path_get_lnode);
PHP_FUNCTION(mecab_path_get_prob);
PHP_FUNCTION(mecab_path_get_cost);

#if PHP_MAJOR_VERSION >= 5
PHP_METHOD(MeCab_Node, __construct);
PHP_METHOD(MeCab_Path, __construct);
#if (PHP_MAJOR_VERSION > 5) || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 1)
ZEND_BEGIN_ARG_INFO_EX(arginfo_mecab_magic_getter, 0, 0, 1)
	ZEND_ARG_INFO(0, name)
ZEND_END_ARG_INFO()
PHP_METHOD(MeCab_Node, __get);
PHP_METHOD(MeCab_Node, __isset);
PHP_METHOD(MeCab_Path, __get);
PHP_METHOD(MeCab_Path, __isset);
#endif
#endif

#ifdef  __cplusplus
} // extern "C" 
#endif

#endif /* PHP_MECAB_H */


/*
 * 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
 */


syntax highlighted by Code2HTML, v. 0.9.1