cvs: pecl /enchant CREDITS enchant.c package.xml php_enchant.h
| From: | Ilia Alshanetsky | Date: | Tue, 09 Mar 2004 00:31:17 +0000 |
| Subject: | cvs: pecl /enchant CREDITS enchant.c package.xml php_enchant.h | ||
| Groups: | php.pecl.cvs | ||
| Request: | Send a blank email to pecl-cvs+get-1028@lists.php.net to get a copy of this message | ||
iliaa Mon Mar 8 19:31:17 2004 EDT
Added files:
/pecl/enchant CREDITS
Modified files:
/pecl/enchant enchant.c package.xml php_enchant.h
Log:
Added enchant_dict_quick_check() function.
Made enchant_dict_check() return a boolean.
http://cvs.php.net/diff.php/pecl/enchant/enchant.c?r1=1.4&r2=1.5&ty=u
Index: pecl/enchant/enchant.c
diff -u pecl/enchant/enchant.c:1.4 pecl/enchant/enchant.c:1.5
--- pecl/enchant/enchant.c:1.4 Mon Mar 8 18:08:17 2004
+++ pecl/enchant/enchant.c Mon Mar 8 19:31:17 2004
@@ -13,9 +13,10 @@
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Pierre-Alain Joye <paj@pearfr.org> |
+ | Ilia Alshanetsky <ilia@prohost.org> |
+----------------------------------------------------------------------+
- $Id: enchant.c,v 1.4 2004/03/08 23:08:17 pajoye Exp $
+ $Id: enchant.c,v 1.5 2004/03/09 00:31:17 iliaa Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -81,6 +82,7 @@
PHP_FE(enchant_dict_store_replacement, NULL)
PHP_FE(enchant_dict_get_error, NULL)
PHP_FE(enchant_dict_describe, NULL)
+ PHP_FE(enchant_dict_quick_check, third_arg_force_ref)
{NULL, NULL, NULL} /* Must be the last line in enchant_functions[] */
};
@@ -229,7 +231,7 @@
php_info_print_table_start();
php_info_print_table_header(2, "enchant support", "enabled");
php_info_print_table_row(2, "Version", "@version@");
- php_info_print_table_row(2, "Revision", "$Revision: 1.4 $");
+ php_info_print_table_row(2, "Revision", "$Revision: 1.5 $");
php_info_print_table_row(1, "Provides");
enchant_broker_describe(pbroker, __enumerate_providers_fn, NULL);
php_info_print_table_end();
@@ -496,8 +498,47 @@
}
/* }}} */
+PHP_FUNCTION(enchant_dict_quick_check)
+{
+ zval *dict, *sugg = NULL;
+ char *word;
+ int wordlen;
+ enchant_dict *pdict;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|z/", &dict, &word,
&wordlen, &sugg) == FAILURE) {
+ RETURN_FALSE;
+ }
+
+ if (sugg) {
+ zval_dtor(sugg);
+ }
+
+ PHP_ENCHANT_GET_DICT;
+
+ if (enchant_dict_check(pdict->pdict, word, wordlen) > 0) {
+ if (!sugg && ZEND_NUM_ARGS() == 2) {
+ RETURN_FALSE;
+ }
+
+ int n_sugg;
+ char **suggs;
+
+ array_init(sugg);
+
+ suggs = enchant_dict_suggest(pdict->pdict, word, wordlen, &n_sugg);
+ if (suggs && n_sugg) {
+ int i;
+ for (i = 0; i < n_sugg; i++) {
+ add_next_index_string(sugg, suggs[i], 1);
+ }
+ }
+ RETURN_FALSE;
+ }
+ RETURN_TRUE;
+}
+
/* {{{ proto long enchant_dict_check(resource broker)
- 0 if the word is correctly spelled, positive if not, negative if error */
+ If the word is correctly spelled return true, otherwise return false */
PHP_FUNCTION(enchant_dict_check)
{
zval *dict;
@@ -511,7 +552,7 @@
PHP_ENCHANT_GET_DICT;
- RETURN_LONG((long)enchant_dict_check(pdict->pdict, word, wordlen));
+ RETURN_BOOL(!enchant_dict_check(pdict->pdict, word, wordlen));
}
/* }}} */
http://cvs.php.net/diff.php/pecl/enchant/package.xml?r1=1.1&r2=1.2&ty=u
Index: pecl/enchant/package.xml
diff -u pecl/enchant/package.xml:1.1 pecl/enchant/package.xml:1.2
--- pecl/enchant/package.xml:1.1 Mon Mar 8 15:12:12 2004
+++ pecl/enchant/package.xml Mon Mar 8 19:31:17 2004
@@ -10,6 +10,12 @@
<email>paj@pearfr.org</email>
<role>lead</role>
</maintainer>
+ <maintainer>
+ <user>iliaa</user>
+ <name>Ilia Alshanetsky</name>
+ <email>ilia@php.net</email>
+ <role>developer</role>
+ </maintainer>
</maintainers>
<description>Enchant is a binder for libenchant. Libenchant provides a common
API for many spell libraries:
@@ -31,6 +37,7 @@
<file role="src" name="config.w32"/>
<file role="src" name="enchant.c"/>
<file role="src" name="php_enchant.h"/>
+ <file role="doc" name="CREDITS"/>
<dir name="docs" role="doc">
<dir name="examples">
<file name="example1.php"/>
http://cvs.php.net/diff.php/pecl/enchant/php_enchant.h?r1=1.1&r2=1.2&ty=u
Index: pecl/enchant/php_enchant.h
diff -u pecl/enchant/php_enchant.h:1.1 pecl/enchant/php_enchant.h:1.2
--- pecl/enchant/php_enchant.h:1.1 Mon Mar 8 15:12:12 2004
+++ pecl/enchant/php_enchant.h Mon Mar 8 19:31:17 2004
@@ -15,7 +15,7 @@
| Author: Pierre-Alain Joye <paj@pearfr.org> |
+----------------------------------------------------------------------+
- $Id: php_enchant.h,v 1.1 2004/03/08 20:12:12 pajoye Exp $
+ $Id: php_enchant.h,v 1.2 2004/03/09 00:31:17 iliaa Exp $
*/
#ifndef PHP_ENCHANT_H
@@ -59,6 +59,7 @@
PHP_FUNCTION(enchant_dict_store_replacement);
PHP_FUNCTION(enchant_dict_get_error);
PHP_FUNCTION(enchant_dict_describe);
+PHP_FUNCTION(enchant_dict_quick_check);
#ifdef ZTS
#define ENCHANT_G(v) TSRMG(enchant_globals_id, zend_enchant_globals *, v)