summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDom Lachowicz <domlachowicz@gmail.com>2006-01-20 05:23:45 +0000
committerDom Lachowicz <domlachowicz@gmail.com>2006-01-20 05:23:45 +0000
commit4848ed9646a58ef0cfa3fa850dd745b217f49b45 (patch)
tree580aa97b0b10dade94d9604e9059c62c54a0ad2f
parentf45cd394b131d9d1c05398267779102fd691f217 (diff)
downloadenchant-4848ed9646a58ef0cfa3fa850dd745b217f49b45.tar.gz
should correct bug #9909
git-svn-id: svn+ssh://svn.abisource.com/svnroot/enchant/trunk@21091 bcba8976-2d24-0410-9c9c-aab3bd5fdfd6
-rw-r--r--configure.in4
-rw-r--r--src/hspell/Makefile.am2
-rw-r--r--src/hspell/hspell_provider.c46
3 files changed, 25 insertions, 27 deletions
diff --git a/configure.in b/configure.in
index b2e8271..f2dade5 100644
--- a/configure.in
+++ b/configure.in
@@ -223,7 +223,7 @@ if test "x$check_hspell" != "xno"; then
AC_CHECK_LIB(hspell,hspell_check_word,build_hspell=yes, build_hspell=no, -lz)
fi
-hspell_dir=${datadir}/enchant/hspell
+hspell_dir=${datadir}/hspell
AC_ARG_WITH(hspell-dir, [ --with-hspell-dir=PATH path to installed hspell dicts ])
if test "x$with_hspell_dir" != "x" ; then
@@ -231,7 +231,7 @@ if test "x$with_hspell_dir" != "x" ; then
fi
HSPELL_LIBS=" -lhspell -lz"
-HSPELL_CFLAGS="$HSPELL_CFLAGS -DENCHANT_HSPELL_DICT_DIR='\"$hspell_dict_dir\"'"
+HSPELL_CFLAGS="$HSPELL_CFLAGS -DENCHANT_HSPELL_DICT_DIR='\"$hspell_dir\"'"
AC_SUBST(HSPELL_CFLAGS)
AC_SUBST(HSPELL_LIBS)
diff --git a/src/hspell/Makefile.am b/src/hspell/Makefile.am
index 1708271..98e0bbb 100644
--- a/src/hspell/Makefile.am
+++ b/src/hspell/Makefile.am
@@ -4,7 +4,7 @@ else
target_lib =
endif
-INCLUDES=-I$(top_srcdir)/src $(ENCHANT_CFLAGS) -D_ENCHANT_BUILD=1
+AM_CPPFLAGS=-I$(top_srcdir)/src $(ENCHANT_CFLAGS) $(HSPELL_CFLAGS) -D_ENCHANT_BUILD=1
hspell_LTLIBRARIES = $(target_lib)
hspelldir= $(libdir)/enchant
diff --git a/src/hspell/hspell_provider.c b/src/hspell/hspell_provider.c
index e779ca3..f979f70 100644
--- a/src/hspell/hspell_provider.c
+++ b/src/hspell/hspell_provider.c
@@ -181,21 +181,6 @@ hspell_dict_suggest (EnchantDict * me, const char *const word,
return sugg_arr;
}
-static int
-hspell_provider_dictionary_exists (struct str_enchant_provider *me,
- const char *const tag)
-{
- /* cheak if tag is he[_IL.something] */
- if ((strlen(tag) >= 2) && tag[0] == 'h' && tag[1] == 'e')
- {
- return TRUE;
- }
- else
- {
- return FALSE;
- }
-}
-
static EnchantDict *
hspell_provider_request_dict (EnchantProvider * me, const char *const tag)
{
@@ -203,7 +188,7 @@ hspell_provider_request_dict (EnchantProvider * me, const char *const tag)
int dict_flag = 0;
struct dict_radix *hspell_dict = NULL;
- if(!hspell_provider_dictionary_exists(me, tag))
+ if(!((strlen(tag) >= 2) && tag[0] == 'h' && tag[1] == 'e'))
return NULL;
/* try to set a new session */
@@ -237,18 +222,32 @@ hspell_provider_dispose_dict (EnchantProvider * me, EnchantDict * dict)
g_free (dict);
}
+/* test for the existence of, then return $prefix/share/hspell/hebrew.wgz */
+
static char **
hspell_provider_list_dicts (EnchantProvider * me,
size_t * out_n_dicts)
{
- char ** out_list;
-
- *out_n_dicts = 2;
-
- out_list = g_new0 (char *, 3);
+ char ** out_list = NULL;
+ *out_n_dicts = 0;
+
+#ifdef ENCHANT_HSPELL_DICT_DIR
+
+ {
+ char * hspell_dictionary;
+
+ hspell_dictionary = g_build_filename(ENCHANT_HSPELL_DICT_DIR, "hebrew.wgz");
+ if(hspell_dictionary && g_file_test (hspell_dictionary, G_FILE_TEST_EXISTS)) {
+ *out_n_dicts = 2;
+
+ out_list = g_new0 (char *, 3);
+
+ out_list[0] = g_strdup ("he_IL");
+ out_list[1] = g_strdup ("he");
+ }
- out_list[0] = g_strdup ("he_IL");
- out_list[1] = g_strdup ("he");
+ g_free(hspell_dictionary);
+#endif
return out_list;
}
@@ -291,7 +290,6 @@ init_enchant_provider (void)
provider->dispose = hspell_provider_dispose;
provider->request_dict = hspell_provider_request_dict;
provider->dispose_dict = hspell_provider_dispose_dict;
- provider->dictionary_exists = hspell_provider_dictionary_exists;
provider->identify = hspell_provider_identify;
provider->describe = hspell_provider_describe;
provider->list_dicts = hspell_provider_list_dicts;