From c2836304dee8c4da5eaba20c1bc6f53647cce820 Mon Sep 17 00:00:00 2001 From: chenxiajian Date: Mon, 15 Aug 2011 15:04:47 +0000 Subject: dealt with Urmas mentioned problem: when the spell-checking dict is missing ,the hyphenaiton function can be used also git-svn-id: svn+ssh://svn.abisource.com/svnroot/enchant/branches/gsoc2011hyphenation@30216 bcba8976-2d24-0410-9c9c-aab3bd5fdfd6 --- src/enchant.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/enchant.c b/src/enchant.c index 3efadfc..98a94e6 100644 --- a/src/enchant.c +++ b/src/enchant.c @@ -25,7 +25,7 @@ * respects for all of the code used other than said providers. If you modify * this file, you may extend this exception to your version of the * file, but you are not obligated to do so. If you do not wish to - * do so, delete this exception statement from your version. + * do so, delete this exception statement from your version. */ #include @@ -42,6 +42,7 @@ #include "enchant-provider.h" #include "pwl.h" + #ifdef XP_TARGET_COCOA #import "enchant_cocoa.h" #endif @@ -112,6 +113,7 @@ typedef void (*EnchantPreConfigureFunc) (EnchantProvider * provider, #define path_cmp strcmp #endif + static GSList* enchant_slist_prepend_unique_path (GSList *slist, gchar* data) { if (NULL == g_slist_find_custom (slist, data, (GCompareFunc)path_cmp)) @@ -1020,14 +1022,35 @@ enchant_dict_hyphenate (EnchantDict * dict, const char *const word, ssize_t len) /* Check for suggestions from provider dictionary */ if (dict->hyphenate) { - dict_suggs = (*dict->hyphenate) (dict, word); + dict_suggs = (*dict->hyphenate) (dict, word); } return dict_suggs; } +ENCHANT_MODULE_EXPORT (char*) +enchant_dict_hyphenateWithoutDic (EnchantDict * dict, const char *const word, ssize_t len) +{ + EnchantSession * session; + size_t n_suggs = 0, n_dict_suggs = 0, n_pwl_suggs = 0, n_suggsT = 0; + char **suggs, *dict_suggs = NULL, **pwl_suggs = NULL, **suggsT; + + + char*result=0; + g_return_val_if_fail (word, NULL); + g_return_val_if_fail (dict, NULL); + + //without dic we can also m_dict + // but only in ispell now + if (dict->hyphenate) + { + dict_suggs = (*dict->hyphenate) (dict, word); + } + + return dict_suggs; +} /** * enchant_dict_add * @dict: A non-null #EnchantDict -- cgit v1.2.1