Optimize the code style and installation DOC for php5 and php7 binnding

This commit is contained in:
lionsoul 2020-02-20 09:49:45 +08:00
parent df3dc81347
commit 411fd22763
4 changed files with 157 additions and 179 deletions

View File

@ -3,34 +3,33 @@
### 安装步骤
* git clone https://github.com/lionsoul2014/friso.git 到当前目录
* cd friso/src 安装 friso, 执行以下命令
~~~shell
make
sudo make install
~~~
~~~shell
$ make
$ sudo make install
~~~
以上命令将会把 libfriso.so 安装到 /usr/lib, 同时将头文件安装到 usr/include/friso
以上命令将会把 libfriso.so 安装到 /usr/lib, 同时将头文件安装到 /usr/include/friso
* 在当前目录运行以下命令安装
phpize
./configure
make && sudo make install
```shell
phpize
./configure
make && sudo make install
```
* 配置 php 扩展文件 friso.ini 指定ini_file路径(cli/fpm)
extension=friso.so
friso.ini_file=/path/to/friso.ini // 这个文件是 friso 的配置文件, (查看 friso/friso.ini)
```
extension=friso.so
friso.ini_file=/path/to/friso.ini // 这个文件是 friso 的配置文件, (查看 friso/friso.ini)
```
通常的做法是在 etc/php5/mods-available 中新建 friso.ini, 然后分别在 cli 和 fpm
通常的做法是在 /etc/php5/mods-available 中新建 friso.ini, 然后分别在 cli 和 fpm
的 conf.d 目录下新建一个软链接指向上面的 /etc/php5/mods-available/friso.ini
* 测试
demo 目录下有对应的测试脚本,执行
~~~shell
$ cd demo
$ php friso.fun.php
~~~
demo 目录下有对应的测试脚本,执行
~~~shell
cd demo
php friso.fun.php
~~~

View File

@ -96,44 +96,43 @@ static void php_friso_globals_destruct(zend_friso_globals *friso_globals)
}
/* }}} */
#define FRISO_RET_WORD (1 << 0)
#define FRISO_RET_TYPE (1 << 1)
#define FRISO_RET_OFF (1 << 2)
#define FRISO_RET_LEN (1 << 3)
#define FRISO_RET_RLEN (1 << 4)
#define FRISO_RET_POS (1 << 5)
#define FRISO_RET_WORD (1 << 0)
#define FRISO_RET_TYPE (1 << 1)
#define FRISO_RET_OFF (1 << 2)
#define FRISO_RET_LEN (1 << 3)
#define FRISO_RET_RLEN (1 << 4)
#define FRISO_RET_POS (1 << 5)
/* {{{ PHP_MINIT_FUNCTION
*/
PHP_MINIT_FUNCTION(friso)
{
/*
* register some contants that robbe may use
* at its following work.
* register some contants that Friso may use at its following work.
* the constant is case sensitive and persitent.
*/
REGISTER_LONG_CONSTANT("FRISO_SIMPLE", __FRISO_SIMPLE_MODE__, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_COMPLEX", __FRISO_COMPLEX_MODE__, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_DETECT", __FRISO_DETECT_MODE__, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_LEX_CJK", __LEX_CJK_WORDS__, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_SIMPLE", __FRISO_SIMPLE_MODE__, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_COMPLEX", __FRISO_COMPLEX_MODE__, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_DETECT", __FRISO_DETECT_MODE__, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_LEX_CJK", __LEX_CJK_WORDS__, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_LEX_STOP", __LEX_STOPWORDS__, CONST_CS | CONST_PERSISTENT);
//return parts for rb_split.
REGISTER_LONG_CONSTANT("FRISO_RET_WORD", FRISO_RET_WORD, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_RET_TYPE", FRISO_RET_TYPE, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_RET_OFF", FRISO_RET_OFF, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_RET_LEN", FRISO_RET_LEN, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_RET_WORD", FRISO_RET_WORD, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_RET_TYPE", FRISO_RET_TYPE, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_RET_OFF", FRISO_RET_OFF, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_RET_LEN", FRISO_RET_LEN, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_RET_RLEN", FRISO_RET_RLEN, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_RET_POS", FRISO_RET_POS, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_RET_POS", FRISO_RET_POS, CONST_CS | CONST_PERSISTENT);
//lex type constants.
REGISTER_LONG_CONSTANT("FRISO_TYP_CJK", __LEX_CJK_WORDS__, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_TYP_ECM", __LEX_ECM_WORDS__, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_TYP_CEM", __LEX_CEM_WORDS__, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_TYP_EPUN", __LEX_ENPUN_WORDS__, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_TYP_PUN", __LEX_OTHER_WORDS__, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_TYP_UNK", __LEX_UNKNOW_WORDS__, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_TYP_OTR", __LEX_OTHER_WORDS__, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_TYP_CJK", __LEX_CJK_WORDS__, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_TYP_ECM", __LEX_ECM_WORDS__, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_TYP_CEM", __LEX_CEM_WORDS__, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_TYP_EPUN", __LEX_ENPUN_WORDS__, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_TYP_PUN", __LEX_OTHER_WORDS__, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_TYP_UNK", __LEX_UNKNOW_WORDS__, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_TYP_OTR", __LEX_OTHER_WORDS__, CONST_CS | CONST_PERSISTENT);
REGISTER_INI_ENTRIES();
/*initialize the globals variables.*/
@ -180,8 +179,8 @@ PHP_MINFO_FUNCTION(friso)
php_info_print_table_start();
php_info_print_table_row(2, "Friso Support", "enabled");
php_info_print_table_row(2, "Version", FRISO_VERSION);
php_info_print_table_row(2, "Bug Report", "chenxin619315@gmail.com");
php_info_print_table_row(2, "Home page", "http://code.google.com/p/friso");
php_info_print_table_row(2, "Bug Report", "dongyado&lt;dongyado@gmail.com&gt;,lionsoul&lt;chenxin619315@gmail.com&gt;");
php_info_print_table_row(2, "Home page", "https://github.com/lionsoul2014/friso");
php_info_print_table_end();
DISPLAY_INI_ENTRIES();
@ -210,26 +209,24 @@ PHP_FUNCTION(friso_split)
//get the arugments from the php layer.
arg_count = ZEND_NUM_ARGS();
switch ( arg_count )
{
case 2:
if ( zend_parse_parameters(arg_count TSRMLS_CC, "sz",
&_str, &slen, &cfg) == FAILURE ) return;
break;
case 3:
if (zend_parse_parameters( arg_count TSRMLS_CC, "szl",
&_str, &slen, &cfg, &rargs) == FAILURE ) return;
break;
default:
WRONG_PARAM_COUNT;
switch ( arg_count ) {
case 2:
if ( zend_parse_parameters(arg_count TSRMLS_CC, "sz",
&_str, &slen, &cfg) == FAILURE ) return;
break;
case 3:
if (zend_parse_parameters( arg_count TSRMLS_CC, "szl",
&_str, &slen, &cfg, &rargs) == FAILURE ) return;
break;
default:
WRONG_PARAM_COUNT;
}
//make sure the RB_RET_WORD will be returned.
//rargs |= FRISO_RET_WORD;
//check and initialize the friso.
if ( Z_TYPE_P(cfg) != IS_NULL )
{
if ( Z_TYPE_P(cfg) != IS_NULL ) {
nconfig = friso_new_config();
memcpy(nconfig, friso_globals.config, sizeof(friso_config_entry));
@ -238,18 +235,14 @@ PHP_FUNCTION(friso_split)
//zend_printf("array length: %d", zend_hash_num_elements(cfgArr));
for ( zend_hash_internal_pointer_reset_ex(cfgArr, &pointer);
zend_hash_get_current_data_ex(cfgArr, (void **)&data, &pointer) == SUCCESS;
zend_hash_move_forward_ex(cfgArr, &pointer) )
{
zend_hash_move_forward_ex(cfgArr, &pointer) ) {
zend_hash_get_current_key_ex(cfgArr, &_key, &klen, NULL, 0, &pointer);
//zend_printf("key: %s, value: %d<br />", _key, (*data)->value.lval);
if ( strcmp(_key, "kpuncs") == 0 )
{
if ( strcmp(_key, "kpuncs") == 0 ) {
memcpy(nconfig->kpuncs, (*data)->value.str.val, (*data)->value.str.len);
nconfig->kpuncs[(*data)->value.str.len] = '\0';
}
else
{
} else {
//convert the data to long.
convert_to_long_ex(data);
if ( strcmp(_key, "max_len") == 0 )
@ -296,12 +289,10 @@ PHP_FUNCTION(friso_split)
if (friso_globals.friso->dic == NULL) {
zend_throw_exception(zend_exception_get_default(TSRMLS_C),
"[Error] Can not load dictionry with lex_dir from friso.ini, please check the ini file", 0 TSRMLS_CC);
RETURN_BOOL(0);
}
while ( config->next_token( friso_globals.friso, config, task ) != NULL )
{
while ( config->next_token( friso_globals.friso, config, task ) != NULL ) {
MAKE_STD_ZVAL(item);
array_init(item);
add_assoc_string(item, "word", task->token->word, 1);
@ -359,11 +350,13 @@ PHP_FUNCTION(friso_dic_exist)
return;
}
if ( friso_globals.friso->dic == NULL )
if ( friso_globals.friso->dic == NULL ) {
RETURN_BOOL(0);
}
if ( type < 0 || type >= __FRISO_LEXICON_LENGTH__ )
if ( type < 0 || type >= __FRISO_LEXICON_LENGTH__ ) {
type = __LEX_CJK_WORDS__;
}
wlen = friso_dic_match( friso_globals.friso->dic, type, word );
@ -386,20 +379,19 @@ PHP_FUNCTION(friso_dic_get)
}
//check the dictionary
if ( friso_globals.friso->dic == NULL )
if ( friso_globals.friso->dic == NULL ) {
RETURN_BOOL(0);
}
MAKE_STD_ZVAL( entry );
array_init( entry );
if ( type < 0 || type >= __FRISO_LEXICON_LENGTH__ )
{
if ( type < 0 || type >= __FRISO_LEXICON_LENGTH__ ) {
type = __LEX_CJK_WORDS__;
}
e = friso_dic_get( friso_globals.friso->dic, type, word );
if ( e != NULL )
{
if ( e != NULL ) {
add_assoc_long( entry, "length", e->length);
add_assoc_long( entry, "freq", e->fre );
*( return_value ) = * ( entry );
@ -421,7 +413,10 @@ PHP_FUNCTION(friso_utf8_bytes)
return;
}
if ( word == NULL ) RETURN_LONG(0);
if ( word == NULL ) {
RETURN_LONG(0);
}
_bytes = get_utf8_bytes( word[0] );
RETURN_LONG(_bytes);

View File

@ -4,33 +4,36 @@
* git clone https://github.com/lionsoul2014/friso.git 到当前目录
* cd friso/src 安装 friso, 执行以下命令
~~~shell
$ make
$ sudo make install
~~~
~~~shell
make
sudo make install
~~~
以上命令将会把 libfriso.so 安装到 /usr/lib, 同时将头文件安装到 /usr/include/friso
以上命令将会把 libfriso.so 安装到 /usr/lib, 同时将头文件安装到 usr/include/friso
* 在当前目录运行以下命令安装
phpize
./configure
make && sudo make install
```shell
phpize
./configure
make && sudo make install
```
* 配置 php 扩展文件 friso.ini 指定ini_file路径(cli/fpm)
extension=friso.so
friso.ini_file=/path/to/friso.ini // 这个文件是 friso 的配置文件, (查看 friso/friso.ini)
```shell
extension=friso.so
friso.ini_file=/path/to/friso.ini // 这个文件是 friso 的配置文件, (查看 friso/friso.ini)
```
通常的做法是在 etc/php/7.0/mods-available 中新建 friso.ini, 然后分别在 cli 和 fpm
通常的做法是在 /etc/php/7.0/mods-available 中新建 friso.ini, 然后分别在 cli 和 fpm
的 conf.d 目录下新建一个软链接指向上面的 /etc/php/7.0/mods-available/friso.ini
* 测试
demo 目录下有对应的测试脚本,执行
demo 目录下有对应的测试脚本,执行
~~~shell
$ cd demo
$ php friso.fun.php
~~~
~~~shell
cd demo
php friso.fun.php
~~~

View File

@ -119,12 +119,12 @@ static void php_friso_globals_destruct(zend_friso_globals *friso_globals)
}
/* }}} */
#define FRISO_RET_WORD (1 << 0)
#define FRISO_RET_TYPE (1 << 1)
#define FRISO_RET_OFF (1 << 2)
#define FRISO_RET_LEN (1 << 3)
#define FRISO_RET_RLEN (1 << 4)
#define FRISO_RET_POS (1 << 5)
#define FRISO_RET_WORD (1 << 0)
#define FRISO_RET_TYPE (1 << 1)
#define FRISO_RET_OFF (1 << 2)
#define FRISO_RET_LEN (1 << 3)
#define FRISO_RET_RLEN (1 << 4)
#define FRISO_RET_POS (1 << 5)
/* {{{ PHP_MINIT_FUNCTION
@ -132,32 +132,31 @@ static void php_friso_globals_destruct(zend_friso_globals *friso_globals)
PHP_MINIT_FUNCTION(friso)
{
/*
* register some contants that robbe may use
* at its following work.
* register some contants that robbe may use at its following work.
* the constant is case sensitive and persitent.
*/
REGISTER_LONG_CONSTANT("FRISO_SIMPLE", __FRISO_SIMPLE_MODE__, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_COMPLEX", __FRISO_COMPLEX_MODE__, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_DETECT", __FRISO_DETECT_MODE__, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_LEX_CJK", __LEX_CJK_WORDS__, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_SIMPLE", __FRISO_SIMPLE_MODE__, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_COMPLEX", __FRISO_COMPLEX_MODE__, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_DETECT", __FRISO_DETECT_MODE__, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_LEX_CJK", __LEX_CJK_WORDS__, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_LEX_STOP", __LEX_STOPWORDS__, CONST_CS | CONST_PERSISTENT);
//return parts for rb_split.
REGISTER_LONG_CONSTANT("FRISO_RET_WORD", FRISO_RET_WORD, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_RET_TYPE", FRISO_RET_TYPE, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_RET_OFF", FRISO_RET_OFF, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_RET_LEN", FRISO_RET_LEN, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_RET_WORD", FRISO_RET_WORD, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_RET_TYPE", FRISO_RET_TYPE, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_RET_OFF", FRISO_RET_OFF, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_RET_LEN", FRISO_RET_LEN, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_RET_RLEN", FRISO_RET_RLEN, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_RET_POS", FRISO_RET_POS, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_RET_POS", FRISO_RET_POS, CONST_CS | CONST_PERSISTENT);
//lex type constants.
REGISTER_LONG_CONSTANT("FRISO_TYP_CJK", __LEX_CJK_WORDS__, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_TYP_ECM", __LEX_ECM_WORDS__, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_TYP_CEM", __LEX_CEM_WORDS__, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_TYP_EPUN", __LEX_ENPUN_WORDS__, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_TYP_PUN", __LEX_OTHER_WORDS__, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_TYP_UNK", __LEX_UNKNOW_WORDS__, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_TYP_OTR", __LEX_OTHER_WORDS__, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_TYP_CJK", __LEX_CJK_WORDS__, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_TYP_ECM", __LEX_ECM_WORDS__, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_TYP_CEM", __LEX_CEM_WORDS__, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_TYP_EPUN", __LEX_ENPUN_WORDS__, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_TYP_PUN", __LEX_OTHER_WORDS__, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_TYP_UNK", __LEX_UNKNOW_WORDS__, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FRISO_TYP_OTR", __LEX_OTHER_WORDS__, CONST_CS | CONST_PERSISTENT);
REGISTER_INI_ENTRIES();
/*initialize the globals variables.*/
@ -207,7 +206,7 @@ PHP_MINFO_FUNCTION(friso)
php_info_print_table_start();
php_info_print_table_row(2, "Friso Support", "enabled");
php_info_print_table_row(2, "Version", FRISO_VERSION);
php_info_print_table_row(2, "Bug Report", "dongyado@gmail.com");
php_info_print_table_row(2, "Bug Report", "dongyado&lt;dongyado@gmail.com&gt;,lionsoul&lt;chenxin619315@gmail.com&gt;");
php_info_print_table_row(2, "Home page", "https://github.com/lionsoul2014/friso");
php_info_print_table_end();
@ -236,18 +235,17 @@ PHP_FUNCTION(friso_split)
//get the arugments from the php layer.
arg_count = ZEND_NUM_ARGS();
switch ( arg_count )
{
case 2:
if ( zend_parse_parameters(arg_count TSRMLS_CC, "sz",
&_str, &slen, &cfg) == FAILURE ) return;
break;
case 3:
if (zend_parse_parameters( arg_count TSRMLS_CC, "szl",
&_str, &slen, &cfg, &rargs) == FAILURE ) return;
break;
default:
WRONG_PARAM_COUNT;
switch ( arg_count ) {
case 2:
if ( zend_parse_parameters(arg_count TSRMLS_CC, "sz",
&_str, &slen, &cfg) == FAILURE ) return;
break;
case 3:
if (zend_parse_parameters( arg_count TSRMLS_CC, "szl",
&_str, &slen, &cfg, &rargs) == FAILURE ) return;
break;
default:
WRONG_PARAM_COUNT;
}
@ -257,18 +255,14 @@ PHP_FUNCTION(friso_split)
friso_config_t config = NULL, nconfig = NULL;
//check and initialize the friso.
if ( Z_TYPE_P(cfg) != IS_NULL )
{
if ( Z_TYPE_P(cfg) != IS_NULL ) {
nconfig = friso_new_config();
memcpy(nconfig, friso_globals.config, sizeof(friso_config_entry));
//check the new setting.
cfgArr = Z_ARRVAL_P(cfg);
ZEND_HASH_FOREACH_KEY_VAL(cfgArr, num_key, key, setting)
{
if ( strcmp(ZSTR_VAL(key), "kpuncs") == 0 )
{
ZEND_HASH_FOREACH_KEY_VAL(cfgArr, num_key, key, setting) {
if ( strcmp(ZSTR_VAL(key), "kpuncs") == 0 ) {
// memcpy(nconfig->kpuncs, val->value.str->val, val->value.str->len);
memcpy(nconfig->kpuncs, Z_STRVAL_P(setting), Z_STRLEN_P(setting));
nconfig->kpuncs[Z_STRLEN_P(setting)] = '\0';
@ -281,41 +275,29 @@ PHP_FUNCTION(friso_split)
//convert_to_long_ex(val);
if ( strcmp(ZSTR_VAL(key), "max_len") == 0 )
nconfig->max_len = (ushort_t) Z_LVAL_P(setting);
else if ( strcmp(ZSTR_VAL(key), "r_name") == 0 )
nconfig->r_name = (ushort_t) Z_LVAL_P(setting);
else if ( strcmp(ZSTR_VAL(key), "mix_len") == 0 )
nconfig->mix_len = (ushort_t) Z_LVAL_P(setting);
else if ( strcmp(ZSTR_VAL(key), "lna_len") == 0 )
nconfig->lna_len = (ushort_t) Z_LVAL_P(setting);
else if ( strcmp(ZSTR_VAL(key), "add_syn") == 0 )
nconfig->add_syn = (ushort_t) Z_LVAL_P(setting);
else if ( strcmp(ZSTR_VAL(key), "clr_stw") == 0 )
nconfig->clr_stw = (ushort_t) Z_LVAL_P(setting);
else if ( strcmp(ZSTR_VAL(key), "add_syn") == 0 )
nconfig->add_syn = (ushort_t) Z_LVAL_P(setting);
else if ( strcmp(ZSTR_VAL(key), "keep_urec") == 0 )
nconfig->keep_urec = (ushort_t) Z_LVAL_P(setting);
else if ( strcmp(ZSTR_VAL(key), "spx_out") == 0 )
nconfig->spx_out = (ushort_t) Z_LVAL_P(setting);
else if ( strcmp(ZSTR_VAL(key), "nthreshold") == 0 )
nconfig->nthreshold = (uint_t) Z_LVAL_P(setting);
else if ( strcmp(ZSTR_VAL(key), "mode") == 0 )
friso_set_mode(nconfig, (friso_mode_t)(Z_LVAL_P(setting)));
else if ( strcmp(ZSTR_VAL(key), "en_sseg") == 0 )
nconfig->en_sseg = (ushort_t) Z_LVAL_P(setting);
else if ( strcmp(ZSTR_VAL(key), "st_minl") == 0)
else if ( strcmp(ZSTR_VAL(key), "r_name") == 0 )
nconfig->r_name = (ushort_t) Z_LVAL_P(setting);
else if ( strcmp(ZSTR_VAL(key), "mix_len") == 0 )
nconfig->mix_len = (ushort_t) Z_LVAL_P(setting);
else if ( strcmp(ZSTR_VAL(key), "lna_len") == 0 )
nconfig->lna_len = (ushort_t) Z_LVAL_P(setting);
else if ( strcmp(ZSTR_VAL(key), "add_syn") == 0 )
nconfig->add_syn = (ushort_t) Z_LVAL_P(setting);
else if ( strcmp(ZSTR_VAL(key), "clr_stw") == 0 )
nconfig->clr_stw = (ushort_t) Z_LVAL_P(setting);
else if ( strcmp(ZSTR_VAL(key), "add_syn") == 0 )
nconfig->add_syn = (ushort_t) Z_LVAL_P(setting);
else if ( strcmp(ZSTR_VAL(key), "keep_urec") == 0 )
nconfig->keep_urec = (ushort_t) Z_LVAL_P(setting);
else if ( strcmp(ZSTR_VAL(key), "spx_out") == 0 )
nconfig->spx_out = (ushort_t) Z_LVAL_P(setting);
else if ( strcmp(ZSTR_VAL(key), "nthreshold") == 0 )
nconfig->nthreshold = (uint_t) Z_LVAL_P(setting);
else if ( strcmp(ZSTR_VAL(key), "mode") == 0 )
friso_set_mode(nconfig, (friso_mode_t)(Z_LVAL_P(setting)));
else if ( strcmp(ZSTR_VAL(key), "en_sseg") == 0 )
nconfig->en_sseg = (ushort_t) Z_LVAL_P(setting);
else if ( strcmp(ZSTR_VAL(key), "st_minl") == 0)
nconfig->st_minl = (ushort_t) Z_LVAL_P(setting);
}
} ZEND_HASH_FOREACH_END();
@ -339,8 +321,7 @@ PHP_FUNCTION(friso_split)
RETURN_BOOL(0);
}
while ( config->next_token( friso_globals.friso, config, task ) != NULL )
{
while ( config->next_token( friso_globals.friso, config, task ) != NULL ) {
array_init(&item);
add_assoc_string(&item, "word", task->token->word);