static PyObject * HunSpell_add(HunSpell * self, PyObject *args) { char *word; int retvalue; if (!PyArg_ParseTuple(args, "s", &word)) return NULL; retvalue = Hunspell_add(self->handle, word); return Py_BuildValue("i", retvalue); }
void AddWordToDictionary(wchar_t * wWord, BOOL addToCustom){ int len; char *word; len = wcslen(wWord) + 1; word = calloc(len, sizeof(char)); WideCharToMultiByte(m_CodePage, 0, wWord, -1, word, len, NULL, NULL); Hunspell_add(m_hh, word); free(word); if(addToCustom){ _addToCustomDictionary(wWord); } }
void gw_spellcheck_add_menuitem_activated_cb (GtkWidget *widget, gpointer data) { GwSpellcheck *spellcheck; GwSpellcheckPrivate *priv; gchar *word; spellcheck = GW_SPELLCHECK (data); priv = spellcheck->priv; word = (gchar*) g_object_get_data (G_OBJECT (widget), "word"); if (priv->handle == NULL) return; Hunspell_add (priv->handle, word); gw_spellcheck_queue (spellcheck); }
static void _addToDictionary(HWND hwnd){ int index, len; HWND hEdit = (HWND)GetPropW(hwnd, EDIT_PROP); PSUGGESTION ps; char *word; index = SendDlgItemMessageW(hwnd, IDC_LST_MISPRINTS, LB_GETCURSEL, 0, 0); if(index == LB_ERR) return; ps = (PSUGGESTION)SendDlgItemMessageW(hwnd, IDC_LST_MISPRINTS, LB_GETITEMDATA, index, 0); len = wcslen(ps->word) + 1; word = calloc(len, sizeof(char)); WideCharToMultiByte(m_CodePage, 0, ps->word, -1, word, len, NULL, NULL); Hunspell_add(m_hh, word); _addToCustomDictionary(ps->word); RedrawWindow(hEdit, NULL, NULL, RDW_INVALIDATE); free(word); _ignoreAll(hwnd); }