| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Pierre-Alain Joye <paj@pearfr.org> |
+ | Ilia Alshanetsky <ilia@prohost.org> |
+----------------------------------------------------------------------+
$Id$
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[] */
};
}
/* }}} */
+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;
PHP_ENCHANT_GET_DICT;
- RETURN_LONG((long)enchant_dict_check(pdict->pdict, word, wordlen));
+ RETURN_BOOL(!enchant_dict_check(pdict->pdict, word, wordlen));
}
/* }}} */
<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:
<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"/>