Example #1
0
/* {{{ proto bool pspell_add_to_personal(int pspell, string word)
   Adds a word to a personal list */
static PHP_FUNCTION(pspell_add_to_personal)
{
	size_t word_len;
	zend_long scin;
	char *word;
	PspellManager *manager;

	if (zend_parse_parameters(ZEND_NUM_ARGS(), "ls", &scin, &word, &word_len) == FAILURE) {
		return;
	}

	PSPELL_FETCH_MANAGER;

	/*If the word is empty, we have to return; otherwise we'll segfault! ouch!*/
	if (word_len == 0) {
		RETURN_FALSE;
	}

	pspell_manager_add_to_personal(manager, word);
	if (pspell_manager_error_number(manager) == 0) {
		RETURN_TRUE;
	} else {
		php_error_docref(NULL, E_WARNING, "pspell_add_to_personal() gave error: %s", pspell_manager_error_message(manager));
		RETURN_FALSE;
	}
}
Example #2
0
static void
aspell_dict_add_to_personal (EnchantDict * me,
			     const char *const word, size_t len)
{
	PspellManager *manager;
	
	manager = (PspellManager *) me->user_data;
	pspell_manager_add_to_personal (manager, word, len);
	pspell_manager_save_all_word_lists (manager);
}