mirror of
https://github.com/php/php-src.git
synced 2025-08-16 14:08:47 +02:00
Convert pspell resources to objects
This commit is contained in:
parent
da97b031f0
commit
bd12c94f46
5 changed files with 234 additions and 178 deletions
4
NEWS
4
NEWS
|
@ -8,4 +8,8 @@ PHP NEWS
|
||||||
- GD:
|
- GD:
|
||||||
. Convert resource<gd font> to object \GdFont. (Sara)
|
. Convert resource<gd font> to object \GdFont. (Sara)
|
||||||
|
|
||||||
|
- PSpell:
|
||||||
|
. Convert resource<pspell> to object \PSpell. (Sara)
|
||||||
|
. Convert resource<pspell config> to object \PSPellConfig. (Sara)
|
||||||
|
|
||||||
<<< NOTE: Insert NEWS from last stable release here prior to actual release! >>>
|
<<< NOTE: Insert NEWS from last stable release here prior to actual release! >>>
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "php.h"
|
#include "php.h"
|
||||||
|
#include "zend_interfaces.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
@ -48,58 +49,139 @@
|
||||||
static PHP_MINIT_FUNCTION(pspell);
|
static PHP_MINIT_FUNCTION(pspell);
|
||||||
static PHP_MINFO_FUNCTION(pspell);
|
static PHP_MINFO_FUNCTION(pspell);
|
||||||
|
|
||||||
static int le_pspell, le_pspell_config;
|
static zend_class_entry *php_pspell_ce = NULL;
|
||||||
|
static zend_object_handlers php_pspell_handlers;
|
||||||
|
static zend_class_entry *php_pspell_config_ce = NULL;
|
||||||
|
static zend_object_handlers php_pspell_config_handlers;
|
||||||
|
|
||||||
zend_module_entry pspell_module_entry = {
|
zend_module_entry pspell_module_entry = {
|
||||||
STANDARD_MODULE_HEADER,
|
STANDARD_MODULE_HEADER,
|
||||||
"pspell", ext_functions, PHP_MINIT(pspell), NULL, NULL, NULL, PHP_MINFO(pspell), PHP_PSPELL_VERSION, STANDARD_MODULE_PROPERTIES
|
"pspell",
|
||||||
|
ext_functions,
|
||||||
|
PHP_MINIT(pspell),
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
PHP_MINFO(pspell),
|
||||||
|
PHP_PSPELL_VERSION,
|
||||||
|
STANDARD_MODULE_PROPERTIES,
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef COMPILE_DL_PSPELL
|
#ifdef COMPILE_DL_PSPELL
|
||||||
ZEND_GET_MODULE(pspell)
|
ZEND_GET_MODULE(pspell)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void php_pspell_close(zend_resource *rsrc)
|
/* class PSpell */
|
||||||
{
|
|
||||||
PspellManager *manager = (PspellManager *)rsrc->ptr;
|
|
||||||
|
|
||||||
delete_pspell_manager(manager);
|
typedef struct _php_pspell_object {
|
||||||
|
PspellManager *mgr;
|
||||||
|
zend_object std;
|
||||||
|
} php_pspell_object;
|
||||||
|
|
||||||
|
static php_pspell_object *php_pspell_object_from_zend_object(zend_object *zobj) {
|
||||||
|
return ((php_pspell_object*)(zobj + 1)) - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void php_pspell_close_config(zend_resource *rsrc)
|
static zend_object *php_pspell_object_to_zend_object(php_pspell_object *obj) {
|
||||||
{
|
return ((zend_object*)(obj + 1)) - 1;
|
||||||
PspellConfig *config = (PspellConfig *)rsrc->ptr;
|
|
||||||
|
|
||||||
delete_pspell_config(config);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define PSPELL_FETCH_CONFIG do { \
|
static zend_function *php_pspell_object_get_constructor(zend_object *object)
|
||||||
zval *res = zend_hash_index_find(&EG(regular_list), conf); \
|
{
|
||||||
if (res == NULL || Z_RES_P(res)->type != le_pspell_config) { \
|
zend_throw_error(NULL, "You cannot initialize a PSpell object except through helper functions");
|
||||||
zend_throw_error(NULL, "%s(): " ZEND_LONG_FMT " is not a PSPELL config index", get_active_function_name(), conf); \
|
return NULL;
|
||||||
RETURN_THROWS(); \
|
}
|
||||||
} \
|
|
||||||
config = (PspellConfig *)Z_RES_P(res)->ptr; \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define PSPELL_FETCH_MANAGER do { \
|
static zend_object *php_pspell_object_create(zend_class_entry *ce)
|
||||||
zval *res = zend_hash_index_find(&EG(regular_list), scin); \
|
{
|
||||||
if (res == NULL || Z_RES_P(res)->type != le_pspell) { \
|
php_pspell_object *obj = zend_object_alloc(sizeof(php_pspell_object), ce);
|
||||||
zend_throw_error(NULL, "%s(): " ZEND_LONG_FMT " is not a PSPELL result index", get_active_function_name(), scin); \
|
zend_object *zobj = php_pspell_object_to_zend_object(obj);
|
||||||
RETURN_THROWS(); \
|
|
||||||
} \
|
obj->mgr = NULL;
|
||||||
manager = (PspellManager *)Z_RES_P(res)->ptr; \
|
zend_object_std_init(zobj, ce);
|
||||||
} while (0);
|
object_properties_init(zobj, ce);
|
||||||
|
zobj->handlers = &php_pspell_handlers;
|
||||||
|
|
||||||
|
return zobj;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void php_pspell_object_free(zend_object *zobj) {
|
||||||
|
delete_pspell_manager(php_pspell_object_from_zend_object(zobj)->mgr);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* class PSpellConfig */
|
||||||
|
|
||||||
|
typedef struct _php_pspell_config_object {
|
||||||
|
PspellConfig *cfg;
|
||||||
|
zend_object std;
|
||||||
|
} php_pspell_config_object;
|
||||||
|
|
||||||
|
static php_pspell_config_object *php_pspell_config_object_from_zend_object(zend_object *zobj) {
|
||||||
|
return ((php_pspell_config_object*)(zobj + 1)) - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static zend_object *php_pspell_config_object_to_zend_object(php_pspell_config_object *obj) {
|
||||||
|
return ((zend_object*)(obj + 1)) - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static zend_function *php_pspell_config_object_get_constructor(zend_object *object)
|
||||||
|
{
|
||||||
|
zend_throw_error(NULL, "You cannot initialize a PSpellConfig object except through helper functions");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static zend_object *php_pspell_config_object_create(zend_class_entry *ce)
|
||||||
|
{
|
||||||
|
php_pspell_config_object *obj = zend_object_alloc(sizeof(php_pspell_config_object), ce);
|
||||||
|
zend_object *zobj = php_pspell_config_object_to_zend_object(obj);
|
||||||
|
|
||||||
|
obj->cfg = NULL;
|
||||||
|
zend_object_std_init(zobj, ce);
|
||||||
|
object_properties_init(zobj, ce);
|
||||||
|
zobj->handlers = &php_pspell_config_handlers;
|
||||||
|
|
||||||
|
return zobj;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void php_pspell_config_object_free(zend_object *zobj) {
|
||||||
|
delete_pspell_config(php_pspell_config_object_from_zend_object(zobj)->cfg);
|
||||||
|
}
|
||||||
|
|
||||||
/* {{{ PHP_MINIT_FUNCTION */
|
/* {{{ PHP_MINIT_FUNCTION */
|
||||||
static PHP_MINIT_FUNCTION(pspell)
|
static PHP_MINIT_FUNCTION(pspell)
|
||||||
{
|
{
|
||||||
|
zend_class_entry ce;
|
||||||
|
INIT_CLASS_ENTRY(ce, "PSpell", class_PSpell_methods);
|
||||||
|
php_pspell_ce = zend_register_internal_class(&ce);
|
||||||
|
php_pspell_ce->ce_flags |= ZEND_ACC_FINAL;
|
||||||
|
php_pspell_ce->create_object = php_pspell_object_create;
|
||||||
|
php_pspell_ce->serialize = zend_class_serialize_deny;
|
||||||
|
php_pspell_ce->unserialize = zend_class_unserialize_deny;
|
||||||
|
|
||||||
|
memcpy(&php_pspell_handlers, &std_object_handlers, sizeof(zend_object_handlers));
|
||||||
|
php_pspell_handlers.clone_obj = NULL;
|
||||||
|
php_pspell_handlers.free_obj = php_pspell_object_free;
|
||||||
|
php_pspell_handlers.get_constructor = php_pspell_object_get_constructor;
|
||||||
|
php_pspell_handlers.offset = XtOffsetOf(php_pspell_object, std);
|
||||||
|
|
||||||
|
INIT_CLASS_ENTRY(ce, "PSpellConfig", class_PSpellConfig_methods);
|
||||||
|
php_pspell_config_ce = zend_register_internal_class(&ce);
|
||||||
|
php_pspell_config_ce->ce_flags |= ZEND_ACC_FINAL;
|
||||||
|
php_pspell_config_ce->create_object = php_pspell_config_object_create;
|
||||||
|
php_pspell_config_ce->serialize = zend_class_serialize_deny;
|
||||||
|
php_pspell_config_ce->unserialize = zend_class_unserialize_deny;
|
||||||
|
|
||||||
|
memcpy(&php_pspell_config_handlers, &std_object_handlers, sizeof(zend_object_handlers));
|
||||||
|
php_pspell_config_handlers.clone_obj = NULL;
|
||||||
|
php_pspell_config_handlers.free_obj = php_pspell_config_object_free;
|
||||||
|
php_pspell_config_handlers.get_constructor = php_pspell_config_object_get_constructor;
|
||||||
|
php_pspell_config_handlers.offset = XtOffsetOf(php_pspell_config_object, std);
|
||||||
|
|
||||||
REGISTER_LONG_CONSTANT("PSPELL_FAST", PSPELL_FAST, CONST_PERSISTENT | CONST_CS);
|
REGISTER_LONG_CONSTANT("PSPELL_FAST", PSPELL_FAST, CONST_PERSISTENT | CONST_CS);
|
||||||
REGISTER_LONG_CONSTANT("PSPELL_NORMAL", PSPELL_NORMAL, CONST_PERSISTENT | CONST_CS);
|
REGISTER_LONG_CONSTANT("PSPELL_NORMAL", PSPELL_NORMAL, CONST_PERSISTENT | CONST_CS);
|
||||||
REGISTER_LONG_CONSTANT("PSPELL_BAD_SPELLERS", PSPELL_BAD_SPELLERS, CONST_PERSISTENT | CONST_CS);
|
REGISTER_LONG_CONSTANT("PSPELL_BAD_SPELLERS", PSPELL_BAD_SPELLERS, CONST_PERSISTENT | CONST_CS);
|
||||||
REGISTER_LONG_CONSTANT("PSPELL_RUN_TOGETHER", PSPELL_RUN_TOGETHER, CONST_PERSISTENT | CONST_CS);
|
REGISTER_LONG_CONSTANT("PSPELL_RUN_TOGETHER", PSPELL_RUN_TOGETHER, CONST_PERSISTENT | CONST_CS);
|
||||||
le_pspell = zend_register_list_destructors_ex(php_pspell_close, NULL, "pspell", module_number);
|
|
||||||
le_pspell_config = zend_register_list_destructors_ex(php_pspell_close_config, NULL, "pspell config", module_number);
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
@ -111,7 +193,6 @@ PHP_FUNCTION(pspell_new)
|
||||||
size_t language_len, spelling_len = 0, jargon_len = 0, encoding_len = 0;
|
size_t language_len, spelling_len = 0, jargon_len = 0, encoding_len = 0;
|
||||||
zend_long mode = Z_L(0), speed = Z_L(0);
|
zend_long mode = Z_L(0), speed = Z_L(0);
|
||||||
int argc = ZEND_NUM_ARGS();
|
int argc = ZEND_NUM_ARGS();
|
||||||
zval *ind;
|
|
||||||
|
|
||||||
#ifdef PHP_WIN32
|
#ifdef PHP_WIN32
|
||||||
TCHAR aspell_dir[200];
|
TCHAR aspell_dir[200];
|
||||||
|
@ -122,7 +203,6 @@ PHP_FUNCTION(pspell_new)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PspellCanHaveError *ret;
|
PspellCanHaveError *ret;
|
||||||
PspellManager *manager;
|
|
||||||
PspellConfig *config;
|
PspellConfig *config;
|
||||||
|
|
||||||
if (zend_parse_parameters(argc, "s|sssl", &language, &language_len, &spelling, &spelling_len,
|
if (zend_parse_parameters(argc, "s|sssl", &language, &language_len, &spelling, &spelling_len,
|
||||||
|
@ -194,9 +274,8 @@ PHP_FUNCTION(pspell_new)
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
manager = to_pspell_manager(ret);
|
object_init_ex(return_value, php_pspell_ce);
|
||||||
ind = zend_list_insert(manager, le_pspell);
|
php_pspell_object_from_zend_object(Z_OBJ_P(return_value))->mgr = to_pspell_manager(ret);
|
||||||
RETURN_LONG(Z_RES_HANDLE_P(ind));
|
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
|
@ -207,7 +286,6 @@ PHP_FUNCTION(pspell_new_personal)
|
||||||
size_t personal_len, language_len, spelling_len = 0, jargon_len = 0, encoding_len = 0;
|
size_t personal_len, language_len, spelling_len = 0, jargon_len = 0, encoding_len = 0;
|
||||||
zend_long mode = Z_L(0), speed = Z_L(0);
|
zend_long mode = Z_L(0), speed = Z_L(0);
|
||||||
int argc = ZEND_NUM_ARGS();
|
int argc = ZEND_NUM_ARGS();
|
||||||
zval *ind;
|
|
||||||
|
|
||||||
#ifdef PHP_WIN32
|
#ifdef PHP_WIN32
|
||||||
TCHAR aspell_dir[200];
|
TCHAR aspell_dir[200];
|
||||||
|
@ -218,7 +296,6 @@ PHP_FUNCTION(pspell_new_personal)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PspellCanHaveError *ret;
|
PspellCanHaveError *ret;
|
||||||
PspellManager *manager;
|
|
||||||
PspellConfig *config;
|
PspellConfig *config;
|
||||||
|
|
||||||
if (zend_parse_parameters(argc, "ps|sssl", &personal, &personal_len, &language, &language_len,
|
if (zend_parse_parameters(argc, "ps|sssl", &personal, &personal_len, &language, &language_len,
|
||||||
|
@ -298,26 +375,22 @@ PHP_FUNCTION(pspell_new_personal)
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
manager = to_pspell_manager(ret);
|
object_init_ex(return_value, php_pspell_ce);
|
||||||
ind = zend_list_insert(manager, le_pspell);
|
php_pspell_object_from_zend_object(Z_OBJ_P(return_value))->mgr = to_pspell_manager(ret);
|
||||||
RETURN_LONG(Z_RES_HANDLE_P(ind));
|
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ Load a dictionary based on the given config */
|
/* {{{ Load a dictionary based on the given config */
|
||||||
PHP_FUNCTION(pspell_new_config)
|
PHP_FUNCTION(pspell_new_config)
|
||||||
{
|
{
|
||||||
zend_long conf;
|
zval *zcfg;
|
||||||
zval *ind;
|
|
||||||
PspellCanHaveError *ret;
|
PspellCanHaveError *ret;
|
||||||
PspellManager *manager;
|
|
||||||
PspellConfig *config;
|
PspellConfig *config;
|
||||||
|
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &conf) == FAILURE) {
|
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &zcfg, php_pspell_config_ce) == FAILURE) {
|
||||||
RETURN_THROWS();
|
RETURN_THROWS();
|
||||||
}
|
}
|
||||||
|
config = php_pspell_config_object_from_zend_object(Z_OBJ_P(zcfg))->cfg;
|
||||||
PSPELL_FETCH_CONFIG;
|
|
||||||
|
|
||||||
ret = new_pspell_manager(config);
|
ret = new_pspell_manager(config);
|
||||||
|
|
||||||
|
@ -327,27 +400,24 @@ PHP_FUNCTION(pspell_new_config)
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
manager = to_pspell_manager(ret);
|
object_init_ex(return_value, php_pspell_ce);
|
||||||
ind = zend_list_insert(manager, le_pspell);
|
php_pspell_object_from_zend_object(Z_OBJ_P(return_value))->mgr = to_pspell_manager(ret);
|
||||||
RETURN_LONG(Z_RES_HANDLE_P(ind));
|
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ Returns true if word is valid */
|
/* {{{ Returns true if word is valid */
|
||||||
PHP_FUNCTION(pspell_check)
|
PHP_FUNCTION(pspell_check)
|
||||||
{
|
{
|
||||||
size_t word_len;
|
zval *zmgr;
|
||||||
zend_long scin;
|
zend_string *word;
|
||||||
char *word;
|
|
||||||
PspellManager *manager;
|
PspellManager *manager;
|
||||||
|
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ls", &scin, &word, &word_len) == FAILURE) {
|
if (zend_parse_parameters(ZEND_NUM_ARGS(), "OS", &zmgr, php_pspell_ce, &word) == FAILURE) {
|
||||||
RETURN_THROWS();
|
RETURN_THROWS();
|
||||||
}
|
}
|
||||||
|
manager = php_pspell_object_from_zend_object(Z_OBJ_P(zmgr))->mgr;
|
||||||
|
|
||||||
PSPELL_FETCH_MANAGER;
|
if (pspell_manager_check(manager, ZSTR_VAL(word))) {
|
||||||
|
|
||||||
if (pspell_manager_check(manager, word)) {
|
|
||||||
RETURN_TRUE;
|
RETURN_TRUE;
|
||||||
} else {
|
} else {
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
|
@ -358,22 +428,20 @@ PHP_FUNCTION(pspell_check)
|
||||||
/* {{{ Returns array of suggestions */
|
/* {{{ Returns array of suggestions */
|
||||||
PHP_FUNCTION(pspell_suggest)
|
PHP_FUNCTION(pspell_suggest)
|
||||||
{
|
{
|
||||||
zend_long scin;
|
zval *zmgr;
|
||||||
char *word;
|
zend_string *word;
|
||||||
size_t word_len;
|
|
||||||
PspellManager *manager;
|
PspellManager *manager;
|
||||||
const PspellWordList *wl;
|
const PspellWordList *wl;
|
||||||
const char *sug;
|
const char *sug;
|
||||||
|
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ls", &scin, &word, &word_len) == FAILURE) {
|
if (zend_parse_parameters(ZEND_NUM_ARGS(), "OS", &zmgr, php_pspell_ce, &word) == FAILURE) {
|
||||||
RETURN_THROWS();
|
RETURN_THROWS();
|
||||||
}
|
}
|
||||||
|
manager = php_pspell_object_from_zend_object(Z_OBJ_P(zmgr))->mgr;
|
||||||
PSPELL_FETCH_MANAGER;
|
|
||||||
|
|
||||||
array_init(return_value);
|
array_init(return_value);
|
||||||
|
|
||||||
wl = pspell_manager_suggest(manager, word);
|
wl = pspell_manager_suggest(manager, ZSTR_VAL(word));
|
||||||
if (wl) {
|
if (wl) {
|
||||||
PspellStringEmulation *els = pspell_word_list_elements(wl);
|
PspellStringEmulation *els = pspell_word_list_elements(wl);
|
||||||
while ((sug = pspell_string_emulation_next(els)) != 0) {
|
while ((sug = pspell_string_emulation_next(els)) != 0) {
|
||||||
|
@ -390,18 +458,16 @@ PHP_FUNCTION(pspell_suggest)
|
||||||
/* {{{ Notify the dictionary of a user-selected replacement */
|
/* {{{ Notify the dictionary of a user-selected replacement */
|
||||||
PHP_FUNCTION(pspell_store_replacement)
|
PHP_FUNCTION(pspell_store_replacement)
|
||||||
{
|
{
|
||||||
size_t miss_len, corr_len;
|
zval *zmgr;
|
||||||
zend_long scin;
|
zend_string *miss, *corr;
|
||||||
char *miss, *corr;
|
|
||||||
PspellManager *manager;
|
PspellManager *manager;
|
||||||
|
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lss", &scin, &miss, &miss_len, &corr, &corr_len) == FAILURE) {
|
if (zend_parse_parameters(ZEND_NUM_ARGS(), "OSS", &zmgr, php_pspell_ce, &miss, &corr) == FAILURE) {
|
||||||
RETURN_THROWS();
|
RETURN_THROWS();
|
||||||
}
|
}
|
||||||
|
manager = php_pspell_object_from_zend_object(Z_OBJ_P(zmgr))->mgr;
|
||||||
|
|
||||||
PSPELL_FETCH_MANAGER;
|
pspell_manager_store_replacement(manager, ZSTR_VAL(miss), ZSTR_VAL(corr));
|
||||||
|
|
||||||
pspell_manager_store_replacement(manager, miss, corr);
|
|
||||||
if (pspell_manager_error_number(manager) == 0) {
|
if (pspell_manager_error_number(manager) == 0) {
|
||||||
RETURN_TRUE;
|
RETURN_TRUE;
|
||||||
} else {
|
} else {
|
||||||
|
@ -414,23 +480,21 @@ PHP_FUNCTION(pspell_store_replacement)
|
||||||
/* {{{ Adds a word to a personal list */
|
/* {{{ Adds a word to a personal list */
|
||||||
PHP_FUNCTION(pspell_add_to_personal)
|
PHP_FUNCTION(pspell_add_to_personal)
|
||||||
{
|
{
|
||||||
size_t word_len;
|
zval *zmgr;
|
||||||
zend_long scin;
|
zend_string *word;
|
||||||
char *word;
|
|
||||||
PspellManager *manager;
|
PspellManager *manager;
|
||||||
|
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ls", &scin, &word, &word_len) == FAILURE) {
|
if (zend_parse_parameters(ZEND_NUM_ARGS(), "OS", &zmgr, php_pspell_ce, &word) == FAILURE) {
|
||||||
RETURN_THROWS();
|
RETURN_THROWS();
|
||||||
}
|
}
|
||||||
|
manager = php_pspell_object_from_zend_object(Z_OBJ_P(zmgr))->mgr;
|
||||||
PSPELL_FETCH_MANAGER;
|
|
||||||
|
|
||||||
/*If the word is empty, we have to return; otherwise we'll segfault! ouch!*/
|
/*If the word is empty, we have to return; otherwise we'll segfault! ouch!*/
|
||||||
if (word_len == 0) {
|
if (ZSTR_LEN(word) == 0) {
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
pspell_manager_add_to_personal(manager, word);
|
pspell_manager_add_to_personal(manager, ZSTR_VAL(word));
|
||||||
if (pspell_manager_error_number(manager) == 0) {
|
if (pspell_manager_error_number(manager) == 0) {
|
||||||
RETURN_TRUE;
|
RETURN_TRUE;
|
||||||
} else {
|
} else {
|
||||||
|
@ -443,23 +507,21 @@ PHP_FUNCTION(pspell_add_to_personal)
|
||||||
/* {{{ Adds a word to the current session */
|
/* {{{ Adds a word to the current session */
|
||||||
PHP_FUNCTION(pspell_add_to_session)
|
PHP_FUNCTION(pspell_add_to_session)
|
||||||
{
|
{
|
||||||
size_t word_len;
|
zval *zmgr;
|
||||||
zend_long scin;
|
zend_string *word;
|
||||||
char *word;
|
|
||||||
PspellManager *manager;
|
PspellManager *manager;
|
||||||
|
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ls", &scin, &word, &word_len) == FAILURE) {
|
if (zend_parse_parameters(ZEND_NUM_ARGS(), "OS", &zmgr, php_pspell_ce, &word) == FAILURE) {
|
||||||
RETURN_THROWS();
|
RETURN_THROWS();
|
||||||
}
|
}
|
||||||
|
manager = php_pspell_object_from_zend_object(Z_OBJ_P(zmgr))->mgr;
|
||||||
PSPELL_FETCH_MANAGER;
|
|
||||||
|
|
||||||
/*If the word is empty, we have to return; otherwise we'll segfault! ouch!*/
|
/*If the word is empty, we have to return; otherwise we'll segfault! ouch!*/
|
||||||
if (word_len == 0) {
|
if (ZSTR_LEN(word) == 0) {
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
pspell_manager_add_to_session(manager, word);
|
pspell_manager_add_to_session(manager, ZSTR_VAL(word));
|
||||||
if (pspell_manager_error_number(manager) == 0) {
|
if (pspell_manager_error_number(manager) == 0) {
|
||||||
RETURN_TRUE;
|
RETURN_TRUE;
|
||||||
} else {
|
} else {
|
||||||
|
@ -472,14 +534,13 @@ PHP_FUNCTION(pspell_add_to_session)
|
||||||
/* {{{ Clears the current session */
|
/* {{{ Clears the current session */
|
||||||
PHP_FUNCTION(pspell_clear_session)
|
PHP_FUNCTION(pspell_clear_session)
|
||||||
{
|
{
|
||||||
zend_long scin;
|
zval *zmgr;
|
||||||
PspellManager *manager;
|
PspellManager *manager;
|
||||||
|
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &scin) == FAILURE) {
|
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &zmgr, php_pspell_ce) == FAILURE) {
|
||||||
RETURN_THROWS();
|
RETURN_THROWS();
|
||||||
}
|
}
|
||||||
|
manager = php_pspell_object_from_zend_object(Z_OBJ_P(zmgr))->mgr;
|
||||||
PSPELL_FETCH_MANAGER;
|
|
||||||
|
|
||||||
pspell_manager_clear_session(manager);
|
pspell_manager_clear_session(manager);
|
||||||
if (pspell_manager_error_number(manager) == 0) {
|
if (pspell_manager_error_number(manager) == 0) {
|
||||||
|
@ -494,14 +555,13 @@ PHP_FUNCTION(pspell_clear_session)
|
||||||
/* {{{ Saves the current (personal) wordlist */
|
/* {{{ Saves the current (personal) wordlist */
|
||||||
PHP_FUNCTION(pspell_save_wordlist)
|
PHP_FUNCTION(pspell_save_wordlist)
|
||||||
{
|
{
|
||||||
zend_long scin;
|
zval *zmgr;
|
||||||
PspellManager *manager;
|
PspellManager *manager;
|
||||||
|
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &scin) == FAILURE) {
|
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &zmgr, php_pspell_ce) == FAILURE) {
|
||||||
RETURN_THROWS();
|
RETURN_THROWS();
|
||||||
}
|
}
|
||||||
|
manager = php_pspell_object_from_zend_object(Z_OBJ_P(zmgr))->mgr;
|
||||||
PSPELL_FETCH_MANAGER;
|
|
||||||
|
|
||||||
pspell_manager_save_all_word_lists(manager);
|
pspell_manager_save_all_word_lists(manager);
|
||||||
|
|
||||||
|
@ -520,7 +580,6 @@ PHP_FUNCTION(pspell_config_create)
|
||||||
{
|
{
|
||||||
char *language, *spelling = NULL, *jargon = NULL, *encoding = NULL;
|
char *language, *spelling = NULL, *jargon = NULL, *encoding = NULL;
|
||||||
size_t language_len, spelling_len = 0, jargon_len = 0, encoding_len = 0;
|
size_t language_len, spelling_len = 0, jargon_len = 0, encoding_len = 0;
|
||||||
zval *ind;
|
|
||||||
PspellConfig *config;
|
PspellConfig *config;
|
||||||
|
|
||||||
#ifdef PHP_WIN32
|
#ifdef PHP_WIN32
|
||||||
|
@ -577,23 +636,22 @@ PHP_FUNCTION(pspell_config_create)
|
||||||
which is not what we want */
|
which is not what we want */
|
||||||
pspell_config_replace(config, "save-repl", "false");
|
pspell_config_replace(config, "save-repl", "false");
|
||||||
|
|
||||||
ind = zend_list_insert(config, le_pspell_config);
|
object_init_ex(return_value, php_pspell_config_ce);
|
||||||
RETURN_LONG(Z_RES_HANDLE_P(ind));
|
php_pspell_config_object_from_zend_object(Z_OBJ_P(return_value))->cfg = config;
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ Consider run-together words as valid components */
|
/* {{{ Consider run-together words as valid components */
|
||||||
PHP_FUNCTION(pspell_config_runtogether)
|
PHP_FUNCTION(pspell_config_runtogether)
|
||||||
{
|
{
|
||||||
zend_long conf;
|
zval *zcfg;
|
||||||
zend_bool runtogether;
|
zend_bool runtogether;
|
||||||
PspellConfig *config;
|
PspellConfig *config;
|
||||||
|
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lb", &conf, &runtogether) == FAILURE) {
|
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ob", &zcfg, php_pspell_config_ce, &runtogether) == FAILURE) {
|
||||||
RETURN_THROWS();
|
RETURN_THROWS();
|
||||||
}
|
}
|
||||||
|
config = php_pspell_config_object_from_zend_object(Z_OBJ_P(zcfg))->cfg;
|
||||||
PSPELL_FETCH_CONFIG;
|
|
||||||
|
|
||||||
pspell_config_replace(config, "run-together", runtogether ? "true" : "false");
|
pspell_config_replace(config, "run-together", runtogether ? "true" : "false");
|
||||||
|
|
||||||
|
@ -604,14 +662,14 @@ PHP_FUNCTION(pspell_config_runtogether)
|
||||||
/* {{{ Select mode for config (PSPELL_FAST, PSPELL_NORMAL or PSPELL_BAD_SPELLERS) */
|
/* {{{ Select mode for config (PSPELL_FAST, PSPELL_NORMAL or PSPELL_BAD_SPELLERS) */
|
||||||
PHP_FUNCTION(pspell_config_mode)
|
PHP_FUNCTION(pspell_config_mode)
|
||||||
{
|
{
|
||||||
zend_long conf, mode;
|
zval *zcfg;
|
||||||
|
zend_long mode;
|
||||||
PspellConfig *config;
|
PspellConfig *config;
|
||||||
|
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll", &conf, &mode) == FAILURE) {
|
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ol", &zcfg, php_pspell_config_ce, &mode) == FAILURE) {
|
||||||
RETURN_THROWS();
|
RETURN_THROWS();
|
||||||
}
|
}
|
||||||
|
config = php_pspell_config_object_from_zend_object(Z_OBJ_P(zcfg))->cfg;
|
||||||
PSPELL_FETCH_CONFIG;
|
|
||||||
|
|
||||||
/* First check what mode we want (how many suggestions) */
|
/* First check what mode we want (how many suggestions) */
|
||||||
if (mode == PSPELL_FAST) {
|
if (mode == PSPELL_FAST) {
|
||||||
|
@ -630,14 +688,14 @@ PHP_FUNCTION(pspell_config_mode)
|
||||||
PHP_FUNCTION(pspell_config_ignore)
|
PHP_FUNCTION(pspell_config_ignore)
|
||||||
{
|
{
|
||||||
char ignore_str[MAX_LENGTH_OF_LONG + 1];
|
char ignore_str[MAX_LENGTH_OF_LONG + 1];
|
||||||
zend_long conf, ignore = 0L;
|
zval *zcfg;
|
||||||
|
zend_long ignore = 0L;
|
||||||
PspellConfig *config;
|
PspellConfig *config;
|
||||||
|
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll", &conf, &ignore) == FAILURE) {
|
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ol", &zcfg, php_pspell_config_ce, &ignore) == FAILURE) {
|
||||||
RETURN_THROWS();
|
RETURN_THROWS();
|
||||||
}
|
}
|
||||||
|
config = php_pspell_config_object_from_zend_object(Z_OBJ_P(zcfg))->cfg;
|
||||||
PSPELL_FETCH_CONFIG;
|
|
||||||
|
|
||||||
snprintf(ignore_str, sizeof(ignore_str), ZEND_LONG_FMT, ignore);
|
snprintf(ignore_str, sizeof(ignore_str), ZEND_LONG_FMT, ignore);
|
||||||
|
|
||||||
|
@ -648,22 +706,20 @@ PHP_FUNCTION(pspell_config_ignore)
|
||||||
|
|
||||||
static void pspell_config_path(INTERNAL_FUNCTION_PARAMETERS, char *option)
|
static void pspell_config_path(INTERNAL_FUNCTION_PARAMETERS, char *option)
|
||||||
{
|
{
|
||||||
zend_long conf;
|
zval *zcfg;
|
||||||
char *value;
|
zend_string *value;
|
||||||
size_t value_len;
|
|
||||||
PspellConfig *config;
|
PspellConfig *config;
|
||||||
|
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lp", &conf, &value, &value_len) == FAILURE) {
|
if (zend_parse_parameters(ZEND_NUM_ARGS(), "OP", &zcfg, php_pspell_config_ce, &value) == FAILURE) {
|
||||||
RETURN_THROWS();
|
RETURN_THROWS();
|
||||||
}
|
}
|
||||||
|
config = php_pspell_config_object_from_zend_object(Z_OBJ_P(zcfg))->cfg;
|
||||||
|
|
||||||
PSPELL_FETCH_CONFIG;
|
if (php_check_open_basedir(ZSTR_VAL(value))) {
|
||||||
|
|
||||||
if (php_check_open_basedir(value)) {
|
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
pspell_config_replace(config, option, value);
|
pspell_config_replace(config, option, ZSTR_VAL(value));
|
||||||
|
|
||||||
RETURN_TRUE;
|
RETURN_TRUE;
|
||||||
}
|
}
|
||||||
|
@ -692,24 +748,22 @@ PHP_FUNCTION(pspell_config_data_dir)
|
||||||
/* {{{ Use a personal dictionary with replacement pairs for this config */
|
/* {{{ Use a personal dictionary with replacement pairs for this config */
|
||||||
PHP_FUNCTION(pspell_config_repl)
|
PHP_FUNCTION(pspell_config_repl)
|
||||||
{
|
{
|
||||||
zend_long conf;
|
zval *zcfg;
|
||||||
char *repl;
|
zend_string *repl;
|
||||||
size_t repl_len;
|
|
||||||
PspellConfig *config;
|
PspellConfig *config;
|
||||||
|
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lp", &conf, &repl, &repl_len) == FAILURE) {
|
if (zend_parse_parameters(ZEND_NUM_ARGS(), "OP", &zcfg, php_pspell_config_ce, &repl) == FAILURE) {
|
||||||
RETURN_THROWS();
|
RETURN_THROWS();
|
||||||
}
|
}
|
||||||
|
config = php_pspell_config_object_from_zend_object(Z_OBJ_P(zcfg))->cfg;
|
||||||
PSPELL_FETCH_CONFIG;
|
|
||||||
|
|
||||||
pspell_config_replace(config, "save-repl", "true");
|
pspell_config_replace(config, "save-repl", "true");
|
||||||
|
|
||||||
if (php_check_open_basedir(repl)) {
|
if (php_check_open_basedir(ZSTR_VAL(repl))) {
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
pspell_config_replace(config, "repl", repl);
|
pspell_config_replace(config, "repl", ZSTR_VAL(repl));
|
||||||
|
|
||||||
RETURN_TRUE;
|
RETURN_TRUE;
|
||||||
}
|
}
|
||||||
|
@ -718,15 +772,14 @@ PHP_FUNCTION(pspell_config_repl)
|
||||||
/* {{{ Save replacement pairs when personal list is saved for this config */
|
/* {{{ Save replacement pairs when personal list is saved for this config */
|
||||||
PHP_FUNCTION(pspell_config_save_repl)
|
PHP_FUNCTION(pspell_config_save_repl)
|
||||||
{
|
{
|
||||||
zend_long conf;
|
zval *zcfg;
|
||||||
zend_bool save;
|
zend_bool save;
|
||||||
PspellConfig *config;
|
PspellConfig *config;
|
||||||
|
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lb", &conf, &save) == FAILURE) {
|
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ob", &zcfg, php_pspell_config_ce, &save) == FAILURE) {
|
||||||
RETURN_THROWS();
|
RETURN_THROWS();
|
||||||
}
|
}
|
||||||
|
config = php_pspell_config_object_from_zend_object(Z_OBJ_P(zcfg))->cfg;
|
||||||
PSPELL_FETCH_CONFIG;
|
|
||||||
|
|
||||||
pspell_config_replace(config, "save-repl", save ? "true" : "false");
|
pspell_config_replace(config, "save-repl", save ? "true" : "false");
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,10 @@
|
||||||
|
|
||||||
/** @generate-function-entries */
|
/** @generate-function-entries */
|
||||||
|
|
||||||
function pspell_new(string $language, string $spelling = "", string $jargon = "", string $encoding = "", int $mode = 0): int|false {}
|
final class PSpell {}
|
||||||
|
final class PSpellConfig {}
|
||||||
|
|
||||||
|
function pspell_new(string $language, string $spelling = "", string $jargon = "", string $encoding = "", int $mode = 0): PSpell|false {}
|
||||||
|
|
||||||
function pspell_new_personal(
|
function pspell_new_personal(
|
||||||
string $filename,
|
string $filename,
|
||||||
|
@ -11,38 +14,24 @@ function pspell_new_personal(
|
||||||
string $jargon = "",
|
string $jargon = "",
|
||||||
string $encoding = "",
|
string $encoding = "",
|
||||||
int $mode = 0
|
int $mode = 0
|
||||||
): int|false {}
|
): PSpell|false {}
|
||||||
|
|
||||||
function pspell_new_config(int $config): int|false {}
|
function pspell_new_config(PSpellConfig $config): PSpell|false {}
|
||||||
|
|
||||||
function pspell_check(int $dictionary, string $word): bool {}
|
function pspell_check(PSpell $dictionary, string $word): bool {}
|
||||||
|
function pspell_suggest(PSpell $dictionary, string $word): array|false {}
|
||||||
|
function pspell_store_replacement(PSpell $dictionary, string $misspelled, string $correct): bool {}
|
||||||
|
function pspell_add_to_personal(PSpell $dictionary, string $word): bool {}
|
||||||
|
function pspell_add_to_session(PSpell $dictionary, string $word): bool {}
|
||||||
|
function pspell_clear_session(PSpell $dictionary): bool {}
|
||||||
|
function pspell_save_wordlist(PSpell $dictionary): bool {}
|
||||||
|
|
||||||
function pspell_suggest(int $dictionary, string $word): array|false {}
|
function pspell_config_create(string $language, string $spelling = "", string $jargon = "", string $encoding = ""): PSpellConfig {}
|
||||||
|
function pspell_config_runtogether(PSpellConfig $config, bool $allow): bool {}
|
||||||
function pspell_store_replacement(int $dictionary, string $misspelled, string $correct): bool {}
|
function pspell_config_mode(PSpellConfig $config, int $mode): bool {}
|
||||||
|
function pspell_config_ignore(PSpellConfig $config, int $min_length): bool {}
|
||||||
function pspell_add_to_personal(int $dictionary, string $word): bool {}
|
function pspell_config_personal(PSpellConfig $config, string $filename): bool {}
|
||||||
|
function pspell_config_dict_dir(PSpellConfig $config, string $directory): bool {}
|
||||||
function pspell_add_to_session(int $dictionary, string $word): bool {}
|
function pspell_config_data_dir(PSpellConfig $config, string $directory): bool {}
|
||||||
|
function pspell_config_repl(PSpellConfig $config, string $filename): bool {}
|
||||||
function pspell_clear_session(int $dictionary): bool {}
|
function pspell_config_save_repl(PSpellConfig $dictionary, bool $save): bool {}
|
||||||
|
|
||||||
function pspell_save_wordlist(int $dictionary): bool {}
|
|
||||||
|
|
||||||
function pspell_config_create(string $language, string $spelling = "", string $jargon = "", string $encoding = ""): int {}
|
|
||||||
|
|
||||||
function pspell_config_runtogether(int $config, bool $allow): bool {}
|
|
||||||
|
|
||||||
function pspell_config_mode(int $config, int $mode): bool {}
|
|
||||||
|
|
||||||
function pspell_config_ignore(int $config, int $min_length): bool {}
|
|
||||||
|
|
||||||
function pspell_config_personal(int $config, string $filename): bool {}
|
|
||||||
|
|
||||||
function pspell_config_dict_dir(int $config, string $directory): bool {}
|
|
||||||
|
|
||||||
function pspell_config_data_dir(int $config, string $directory): bool {}
|
|
||||||
|
|
||||||
function pspell_config_repl(int $config, string $filename): bool {}
|
|
||||||
|
|
||||||
function pspell_config_save_repl(int $dictionary, bool $save): bool {}
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* This is a generated file, edit the .stub.php file instead.
|
/* This is a generated file, edit the .stub.php file instead.
|
||||||
* Stub hash: 9a6f7791175f73d92c3b92da45f282805ea09a1c */
|
* Stub hash: c5195a21d76b23878f26d592ee75bea68941ce51 */
|
||||||
|
|
||||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pspell_new, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
|
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_pspell_new, 0, 1, PSpell, MAY_BE_FALSE)
|
||||||
ZEND_ARG_TYPE_INFO(0, language, IS_STRING, 0)
|
ZEND_ARG_TYPE_INFO(0, language, IS_STRING, 0)
|
||||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, spelling, IS_STRING, 0, "\"\"")
|
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, spelling, IS_STRING, 0, "\"\"")
|
||||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, jargon, IS_STRING, 0, "\"\"")
|
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, jargon, IS_STRING, 0, "\"\"")
|
||||||
|
@ -9,7 +9,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pspell_new, 0, 1, MAY_BE_LONG|MA
|
||||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "0")
|
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "0")
|
||||||
ZEND_END_ARG_INFO()
|
ZEND_END_ARG_INFO()
|
||||||
|
|
||||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pspell_new_personal, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
|
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_pspell_new_personal, 0, 2, PSpell, MAY_BE_FALSE)
|
||||||
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
|
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
|
||||||
ZEND_ARG_TYPE_INFO(0, language, IS_STRING, 0)
|
ZEND_ARG_TYPE_INFO(0, language, IS_STRING, 0)
|
||||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, spelling, IS_STRING, 0, "\"\"")
|
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, spelling, IS_STRING, 0, "\"\"")
|
||||||
|
@ -18,22 +18,22 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pspell_new_personal, 0, 2, MAY_B
|
||||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "0")
|
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "0")
|
||||||
ZEND_END_ARG_INFO()
|
ZEND_END_ARG_INFO()
|
||||||
|
|
||||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pspell_new_config, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
|
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_pspell_new_config, 0, 1, PSpell, MAY_BE_FALSE)
|
||||||
ZEND_ARG_TYPE_INFO(0, config, IS_LONG, 0)
|
ZEND_ARG_OBJ_INFO(0, config, PSpellConfig, 0)
|
||||||
ZEND_END_ARG_INFO()
|
ZEND_END_ARG_INFO()
|
||||||
|
|
||||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pspell_check, 0, 2, _IS_BOOL, 0)
|
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pspell_check, 0, 2, _IS_BOOL, 0)
|
||||||
ZEND_ARG_TYPE_INFO(0, dictionary, IS_LONG, 0)
|
ZEND_ARG_OBJ_INFO(0, dictionary, PSpell, 0)
|
||||||
ZEND_ARG_TYPE_INFO(0, word, IS_STRING, 0)
|
ZEND_ARG_TYPE_INFO(0, word, IS_STRING, 0)
|
||||||
ZEND_END_ARG_INFO()
|
ZEND_END_ARG_INFO()
|
||||||
|
|
||||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pspell_suggest, 0, 2, MAY_BE_ARRAY|MAY_BE_FALSE)
|
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pspell_suggest, 0, 2, MAY_BE_ARRAY|MAY_BE_FALSE)
|
||||||
ZEND_ARG_TYPE_INFO(0, dictionary, IS_LONG, 0)
|
ZEND_ARG_OBJ_INFO(0, dictionary, PSpell, 0)
|
||||||
ZEND_ARG_TYPE_INFO(0, word, IS_STRING, 0)
|
ZEND_ARG_TYPE_INFO(0, word, IS_STRING, 0)
|
||||||
ZEND_END_ARG_INFO()
|
ZEND_END_ARG_INFO()
|
||||||
|
|
||||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pspell_store_replacement, 0, 3, _IS_BOOL, 0)
|
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pspell_store_replacement, 0, 3, _IS_BOOL, 0)
|
||||||
ZEND_ARG_TYPE_INFO(0, dictionary, IS_LONG, 0)
|
ZEND_ARG_OBJ_INFO(0, dictionary, PSpell, 0)
|
||||||
ZEND_ARG_TYPE_INFO(0, misspelled, IS_STRING, 0)
|
ZEND_ARG_TYPE_INFO(0, misspelled, IS_STRING, 0)
|
||||||
ZEND_ARG_TYPE_INFO(0, correct, IS_STRING, 0)
|
ZEND_ARG_TYPE_INFO(0, correct, IS_STRING, 0)
|
||||||
ZEND_END_ARG_INFO()
|
ZEND_END_ARG_INFO()
|
||||||
|
@ -43,12 +43,12 @@ ZEND_END_ARG_INFO()
|
||||||
#define arginfo_pspell_add_to_session arginfo_pspell_check
|
#define arginfo_pspell_add_to_session arginfo_pspell_check
|
||||||
|
|
||||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pspell_clear_session, 0, 1, _IS_BOOL, 0)
|
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pspell_clear_session, 0, 1, _IS_BOOL, 0)
|
||||||
ZEND_ARG_TYPE_INFO(0, dictionary, IS_LONG, 0)
|
ZEND_ARG_OBJ_INFO(0, dictionary, PSpell, 0)
|
||||||
ZEND_END_ARG_INFO()
|
ZEND_END_ARG_INFO()
|
||||||
|
|
||||||
#define arginfo_pspell_save_wordlist arginfo_pspell_clear_session
|
#define arginfo_pspell_save_wordlist arginfo_pspell_clear_session
|
||||||
|
|
||||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pspell_config_create, 0, 1, IS_LONG, 0)
|
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_pspell_config_create, 0, 1, PSpellConfig, 0)
|
||||||
ZEND_ARG_TYPE_INFO(0, language, IS_STRING, 0)
|
ZEND_ARG_TYPE_INFO(0, language, IS_STRING, 0)
|
||||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, spelling, IS_STRING, 0, "\"\"")
|
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, spelling, IS_STRING, 0, "\"\"")
|
||||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, jargon, IS_STRING, 0, "\"\"")
|
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, jargon, IS_STRING, 0, "\"\"")
|
||||||
|
@ -56,27 +56,27 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pspell_config_create, 0, 1, IS_L
|
||||||
ZEND_END_ARG_INFO()
|
ZEND_END_ARG_INFO()
|
||||||
|
|
||||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pspell_config_runtogether, 0, 2, _IS_BOOL, 0)
|
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pspell_config_runtogether, 0, 2, _IS_BOOL, 0)
|
||||||
ZEND_ARG_TYPE_INFO(0, config, IS_LONG, 0)
|
ZEND_ARG_OBJ_INFO(0, config, PSpellConfig, 0)
|
||||||
ZEND_ARG_TYPE_INFO(0, allow, _IS_BOOL, 0)
|
ZEND_ARG_TYPE_INFO(0, allow, _IS_BOOL, 0)
|
||||||
ZEND_END_ARG_INFO()
|
ZEND_END_ARG_INFO()
|
||||||
|
|
||||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pspell_config_mode, 0, 2, _IS_BOOL, 0)
|
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pspell_config_mode, 0, 2, _IS_BOOL, 0)
|
||||||
ZEND_ARG_TYPE_INFO(0, config, IS_LONG, 0)
|
ZEND_ARG_OBJ_INFO(0, config, PSpellConfig, 0)
|
||||||
ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
|
ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
|
||||||
ZEND_END_ARG_INFO()
|
ZEND_END_ARG_INFO()
|
||||||
|
|
||||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pspell_config_ignore, 0, 2, _IS_BOOL, 0)
|
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pspell_config_ignore, 0, 2, _IS_BOOL, 0)
|
||||||
ZEND_ARG_TYPE_INFO(0, config, IS_LONG, 0)
|
ZEND_ARG_OBJ_INFO(0, config, PSpellConfig, 0)
|
||||||
ZEND_ARG_TYPE_INFO(0, min_length, IS_LONG, 0)
|
ZEND_ARG_TYPE_INFO(0, min_length, IS_LONG, 0)
|
||||||
ZEND_END_ARG_INFO()
|
ZEND_END_ARG_INFO()
|
||||||
|
|
||||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pspell_config_personal, 0, 2, _IS_BOOL, 0)
|
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pspell_config_personal, 0, 2, _IS_BOOL, 0)
|
||||||
ZEND_ARG_TYPE_INFO(0, config, IS_LONG, 0)
|
ZEND_ARG_OBJ_INFO(0, config, PSpellConfig, 0)
|
||||||
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
|
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
|
||||||
ZEND_END_ARG_INFO()
|
ZEND_END_ARG_INFO()
|
||||||
|
|
||||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pspell_config_dict_dir, 0, 2, _IS_BOOL, 0)
|
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pspell_config_dict_dir, 0, 2, _IS_BOOL, 0)
|
||||||
ZEND_ARG_TYPE_INFO(0, config, IS_LONG, 0)
|
ZEND_ARG_OBJ_INFO(0, config, PSpellConfig, 0)
|
||||||
ZEND_ARG_TYPE_INFO(0, directory, IS_STRING, 0)
|
ZEND_ARG_TYPE_INFO(0, directory, IS_STRING, 0)
|
||||||
ZEND_END_ARG_INFO()
|
ZEND_END_ARG_INFO()
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ ZEND_END_ARG_INFO()
|
||||||
#define arginfo_pspell_config_repl arginfo_pspell_config_personal
|
#define arginfo_pspell_config_repl arginfo_pspell_config_personal
|
||||||
|
|
||||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pspell_config_save_repl, 0, 2, _IS_BOOL, 0)
|
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pspell_config_save_repl, 0, 2, _IS_BOOL, 0)
|
||||||
ZEND_ARG_TYPE_INFO(0, dictionary, IS_LONG, 0)
|
ZEND_ARG_OBJ_INFO(0, dictionary, PSpellConfig, 0)
|
||||||
ZEND_ARG_TYPE_INFO(0, save, _IS_BOOL, 0)
|
ZEND_ARG_TYPE_INFO(0, save, _IS_BOOL, 0)
|
||||||
ZEND_END_ARG_INFO()
|
ZEND_END_ARG_INFO()
|
||||||
|
|
||||||
|
@ -133,3 +133,13 @@ static const zend_function_entry ext_functions[] = {
|
||||||
ZEND_FE(pspell_config_save_repl, arginfo_pspell_config_save_repl)
|
ZEND_FE(pspell_config_save_repl, arginfo_pspell_config_save_repl)
|
||||||
ZEND_FE_END
|
ZEND_FE_END
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static const zend_function_entry class_PSpell_methods[] = {
|
||||||
|
ZEND_FE_END
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static const zend_function_entry class_PSpellConfig_methods[] = {
|
||||||
|
ZEND_FE_END
|
||||||
|
};
|
||||||
|
|
|
@ -34,7 +34,7 @@ var_dump(pspell_config_ignore($cfg, PHP_INT_MAX));
|
||||||
bool(false)
|
bool(false)
|
||||||
|
|
||||||
Warning: pspell_new_config(): PSPELL couldn't open the dictionary. reason: The encoding "b0rked" is not known. This could also mean that the file "%sb0rked.%s" could not be opened for reading or does not exist. in %s003.php on line 9
|
Warning: pspell_new_config(): PSPELL couldn't open the dictionary. reason: The encoding "b0rked" is not known. This could also mean that the file "%sb0rked.%s" could not be opened for reading or does not exist. in %s003.php on line 9
|
||||||
pspell_check(): 0 is not a PSPELL result index
|
pspell_check(): Argument #1 ($dictionary) must be of type PSpell, bool given
|
||||||
---
|
---
|
||||||
bool(true)
|
bool(true)
|
||||||
bool(true)
|
bool(true)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue