diff options
author | Reuben Thomas <rrt@sc3d.org> | 2017-02-21 15:24:51 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-21 15:24:51 +0000 |
commit | c739fe24f17554517ea387783ccd5f2953f6111a (patch) | |
tree | 18b562524e712bd9c1b2f51f4aa2e331fc8b2d1e | |
parent | b90435e9f241dde68f2e615135d6a7f3e1587d44 (diff) | |
parent | de0f8675f66df4649c3a4e6b11613a42a74fde8a (diff) | |
download | enchant-c739fe24f17554517ea387783ccd5f2953f6111a.tar.gz |
Merge pull request #92 from rrthomas/master
Improve HACKING
-rw-r--r-- | .dir-locals.el | 4 | ||||
-rw-r--r-- | HACKING | 74 | ||||
-rw-r--r-- | configure.ac | 45 | ||||
-rw-r--r-- | data/enchant.ordering | 10 | ||||
-rw-r--r-- | doc/enchant.1 | 18 | ||||
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/enchant.c | 2 | ||||
-rw-r--r-- | src/hunspell/Makefile.am | 21 | ||||
-rw-r--r-- | src/hunspell/README (renamed from src/myspell/README) | 0 | ||||
-rw-r--r-- | src/hunspell/hunspell_checker.cpp (renamed from src/myspell/myspell_checker.cpp) | 134 | ||||
-rw-r--r-- | src/hunspell/libenchant_hunspell.rc (renamed from src/myspell/libenchant_myspell.rc) | 6 | ||||
-rw-r--r-- | src/myspell/Makefile.am | 21 | ||||
-rw-r--r-- | tests/Makefile.am | 2 | ||||
-rw-r--r-- | unittests/broker/enchant_broker_set_ordering_tests.cpp | 4 |
14 files changed, 165 insertions, 178 deletions
diff --git a/.dir-locals.el b/.dir-locals.el new file mode 100644 index 0000000..127a4ad --- /dev/null +++ b/.dir-locals.el @@ -0,0 +1,4 @@ +((c-mode . ((c-file-style . "K&R") + (c-basic-offset . 8) + (tab-width . 8) + (indent-tabs-mode . t)))) @@ -18,80 +18,58 @@ Working in libenchant 2) Maintainable & Documented 3) Modular and well designed - When you submit code to inclusion in libenchant, or when you modify the sources -directly on the CVS repository, please keep those things in mind. While -performance is important please note that we do not want to hand tune code -to shave milliseconds at this point. Well designed algorithms and data -structures are fertile areas for development, obfuscated code to make a -loop 3% faster is not. Specifically, this means: + When you submit code for inclusion in libenchant, please keep those +things in mind. While performance is important please note that +well-designed algorithms and data structures are fertile areas for +development; obfuscated code to make a loop 3% faster is not. Specifically, +this means: - Clarity of design and function are paramount - - Make sure your code does not generate warnings at all. + - Make sure your code does not generate warnings - Please follow the formatting style Formatting style ---------------- - The formatting style of libenchant is a mix of various styles, make -yourself familiar with the GNU coding standards (shipped with most + The formatting style of libenchant is a mix of various styles. Please +familiarise yourself with the GNU coding standards (shipped with most GNU/Linux systems as the standards.info file), then read the Linux -kernel coding standards and ignore Linus' jokes. Then look at the -Gtk+ header files to get acquainted on how to write nice header files -that are almost self documenting. +kernel coding standards and ignore Linus's jokes. Then look at the +Gtk+ header files to get acquainted with how to write nice header files +that are almost self documenting. - Remember: Use 8 space tabs for indentation: that will keep your -code honest as you will be forced to split your routines in more + Emacs users should use the supplied .dir-locals.el. + + Remember: Use tabs for indentation: that will keep your +code honest as you will be forced to split your routines into more modular chunks (as detailed by Linus). - Emacs users can get the default indentation style with this: - (set-c-style "K&R") - (setq c-basic-offset 8) - - On top of that, you will have to: + On top of that, please: - Follow the Gtk+ cleanliness conventions for function prototypes. - - Follow the Gtk+ namespace convention for function names. + - Follow the Gtk+ namespace convention for function names: module_submodule_operation - - Make sure your code does not have a single warning (with the - default strong warnings that Gnumeric compiles with) before - your code is submitted. (Although we do not advocate -Werror) - - Every entry point to a public routine should use the g_return_if_fail and g_return_val_if_fail macros to verify that the parameters passed are valid. - Under no circumstances use magic variables. Use typedef enum { ... } type; to create enumerations. Do not use - integers to hold references to enumerations, the compiler - can help catch various errors. + integers to hold enumeration values: the compiler can help + catch various errors. - Use g_warning to mark spots that need to be reviewed or are - not finished to let me fix it eventually. + not finished. - Do not submit code that is just a temporary workaround for a - full fledged feature. i.e. don't submit a quick hack at - "search text" which is not designed to be expanded upon. We - do not want to maintain limited features. It is better submit an - implementation that has been designed to be expanded and enhanced, - even if it is not completely finished. - - - It is more important to be correct than to be fast. - - - Do not optimize unnecessarily. Do profile, do look for the - weak spots before applying "optimization by feeling". This - is not a Ouija-based project. - - - It is more important to keep the code maintainable and - readable than to be fast. If you have a great idea about - optimizing the code, make sure it is implemented cleanly, - that there is a clean and maintainable way to do it: - - - Fast code that is difficult to maintain has no place in - Enchant and will be dropped. + full fledged feature. We do not want to maintain limited + features. It is better to submit an implementation designed + to be expanded and enhanced, even if it is not completely + finished. - Follow the libenchant commenting style, which is not the Gtk style; @@ -104,8 +82,8 @@ reasonable margins of maintainability for the future: Remember, in two years you will probably be far too busy to maintain your own contributions, and they might become a burden to the program maintainers. - libenchant is intended to be a foundation for a various document centric + libenchant is intended to be a foundation for a various document-centric projects. Cleaning code in libenchant is more important than trying not to break -existing code. Code clean ups are always welcome. +existing code. Code clean-ups are always welcome. diff --git a/configure.ac b/configure.ac index 3d92a6d..94df41c 100644 --- a/configure.ac +++ b/configure.ac @@ -51,8 +51,6 @@ ENCHANT_LT_OBJDIR=$lt_cv_objdir AC_SUBST(ENCHANT_LT_OBJDIR) -PKG_PROG_PKG_CONFIG - PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.6 gmodule-2.0]) dnl Extra warnings with GCC and compatible compilers @@ -263,22 +261,29 @@ AC_SUBST(ISPELL_CFLAGS) dnl Hunspell -AC_ARG_ENABLE(myspell, AS_HELP_STRING([--disable-myspell],[enable the myspell backend @<:@default=auto@:>@]), build_myspell="$enableval", build_myspell=yes) - -AM_CONDITIONAL(WITH_MYSPELL, test "x$build_myspell" = "xyes") - -myspell_dir=${datadir}/myspell/dicts -AC_ARG_WITH(myspell-dir, AS_HELP_STRING([--with-myspell-dir=PATH],[path to installed myspell dicts])) -if test "x$with_myspell_dir" != "x" ; then - myspell_dir=$with_myspell_dir -fi +AC_ARG_WITH([hunspell], + AS_HELP_STRING([--with-hunspell], + [enable the hunspell backend @<:@default=check@:>@]), + [], + [with_hunspell=check]) + +hunspell_dir=${datadir}/hunspell +AC_ARG_WITH([hunspell-dir], + AS_HELP_STRING([--with-hunspell-dir=PATH], + [path to installed Hunspell dicts])) +AS_IF([test "x$with_hunspell_dir" != "x"], + [hunspell_dir=$with_hunspell_dir]) + +AS_IF([test "x$with_hunspell" != xno], + [PKG_CHECK_MODULES([HUNSPELL], [hunspell], + [HUNSPELL_CFLAGS="$HUNSPELL_CFLAGS -DENCHANT_HUNSPELL_DICT_DIR='\"$hunspell_dir\"'" + with_hunspell=yes], + [if test "x$with_hunspell" != xcheck; then + AC_MSG_FAILURE([--with-hunspell was given, but test for Hunspell failed]) + fi + with_hunspell=no])]) -if test "x$build_myspell" = xyes; then - PKG_CHECK_MODULES(MYSPELL, [hunspell]) - AC_SUBST(MYSPELL_CFLAGS) - AC_SUBST(MYSPELL_LIBS) - MYSPELL_CFLAGS="$MYSPELL_CFLAGS -DENCHANT_MYSPELL_DICT_DIR='\"$myspell_dir\"'" -fi +AM_CONDITIONAL(WITH_HUNSPELL, test "x$with_hunspell" = xyes) dnl Aspell @@ -461,7 +466,7 @@ src/Makefile src/aspell/Makefile src/ispell/Makefile src/uspell/Makefile -src/myspell/Makefile +src/hunspell/Makefile src/hspell/Makefile src/applespell/Makefile src/voikko/Makefile @@ -488,8 +493,8 @@ $PACKAGE-$VERSION Build Ispell backend: ${build_ispell} Build Uspell backend: ${build_uspell} Build Hspell backend: ${build_hspell} - Build Myspell/Hunspell backend: ${build_myspell} - Build Voikko backend (Linux only): ${build_voikko} + Build Hunspell backend: ${with_hunspell} + Build Voikko backend: ${build_voikko} Build Zemberek backend: ${build_zemberek} Build Apple Spell backend (OS X only): ${build_applespell}" diff --git a/data/enchant.ordering b/data/enchant.ordering index 8e380fb..012de34 100644 --- a/data/enchant.ordering +++ b/data/enchant.ordering @@ -1,8 +1,8 @@ -*:myspell,aspell,ispell -fi:voikko,ispell,myspell,aspell -fi_FI:voikko,ispell,myspell,aspell -he:hspell,myspell -he_IL:hspell,myspell +*:hunspell,aspell,ispell +fi:voikko,ispell,hunspell,aspell +fi_FI:voikko,ispell,hunspell,aspell +he:hspell,hunspell +he_IL:hspell,hunspell yi:uspell tr:zemberek tr_TR:zemberek diff --git a/doc/enchant.1 b/doc/enchant.1 index 4c557fb..2336cc1 100644 --- a/doc/enchant.1 +++ b/doc/enchant.1 @@ -38,19 +38,19 @@ located in \fI~/.enchant\fR. The per-user file takes precedence, if found. .PP The ordering file takes the form language_tag:<comma-separated list of spelling -backends>. I am currently aware of the following backends: aspell/pspell, -myspell/hunspell, ispell, uspell, hspell, voikko, zemberek, and Apple Spell (macOS only). '*' is +backends>. I am currently aware of the following backends: aspell, +hunspell, ispell, uspell, hspell, voikko, zemberek, and Apple Spell (macOS only). '*' is used to mean "use this ordering for all languages, unless instructed otherwise." For example: .PP -*:aspell,myspell,ispell +*:aspell,hunspell,ispell .br -en:aspell,myspell,ispell +en:aspell,hunspell,ispell .br -en_GB:myspell,aspell,ispell +en_GB:hunspell,aspell,ispell .br -fr:myspell,ispell:aspell +fr:hunspell,ispell:aspell .SH DIRECTORIES IMPORTANT TO ENCHANT -Unless configured otherwise, Enchant's Myspell, Ispell, and Uspell +Unless configured otherwise, Enchant's Hunspell, Ispell, and Uspell backends will look for dictionaries in directories specific to Enchant, and will not use your system-wide installed dictionaries. This is for pragmatic reasons since many distributions install these dictionaries @@ -59,11 +59,11 @@ into different locations. Like the \fIenchant.ordering\fR file described above, Enchant looks in the global directory for these dictionaries and a per-user directory. The per-user directory takes precedence if it is found. -Enchant looks for Myspell dictionaries in \fI$(datadir)/enchant/myspell\fR and \fI~/.enchant/myspell\fR. +Enchant looks for Hunspell dictionaries in \fI$(datadir)/enchant/hunspell\fR and \fI~/.enchant/hunspell\fR. Enchant looks for Ispell dictionaries in \fI$(datadir)/enchant/ispell\fR and \fI~/.enchant/ispell\fR. Enchant looks for Uspell dictionaries in \fI$(datadir)/enchant/uspell\fR and \fI~/.enchant/uspell\fR. .PP -Packagers and users may wish to make symbolic links to the system\-wide dictionary directories. Or, preferably, use the \-\-with-myspell-dir, \-\-with\-ispell\-dir, and \-\-with\-uspell\-dir 'configure' arguments. +Packagers and users may wish to make symbolic links to the system\-wide dictionary directories. Or, preferably, use the \-\-with-hunspell-dir, \-\-with\-ispell\-dir, and \-\-with\-uspell\-dir 'configure' arguments. .SH MORE INFORMATION http://www.abisource.com/enchant/ .SH "SEE ALSO" diff --git a/src/Makefile.am b/src/Makefile.am index 0d2f32b..73f9d3b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS=. aspell ispell uspell myspell hspell applespell voikko zemberek +SUBDIRS=. aspell ispell uspell hunspell hspell applespell voikko zemberek AM_CPPFLAGS = -I$(top_srcdir) $(ISYSTEM)$(top_builddir)/lib $(ISYSTEM)$(top_srcdir)/lib $(ENCHANT_CFLAGS) $(WARN_CFLAGS) diff --git a/src/enchant.c b/src/enchant.c index 98756bc..fe478d8 100644 --- a/src/enchant.c +++ b/src/enchant.c @@ -1905,7 +1905,7 @@ enchant_broker_dict_exists (EnchantBroker * broker, * enchant_broker_set_ordering * @broker: A non-null #EnchantBroker * @tag: A non-null language tag (en_US) - * @ordering: A non-null ordering (aspell,myspell,ispell,uspell,hspell) + * @ordering: A non-null ordering (aspell,hunspell,ispell,uspell,hspell) * * Declares a preference of dictionaries to use for the language * described/referred to by @tag. The ordering is a comma delimited diff --git a/src/hunspell/Makefile.am b/src/hunspell/Makefile.am new file mode 100644 index 0000000..b31de26 --- /dev/null +++ b/src/hunspell/Makefile.am @@ -0,0 +1,21 @@ +if WITH_HUNSPELL +target_lib = libenchant_hunspell.la +else +target_lib = +endif + +AM_CPPFLAGS = -I$(top_srcdir) $(ISYSTEM)$(top_builddir)/lib $(ISYSTEM)$(top_srcdir)/lib -I$(top_srcdir)/src $(ENCHANT_CFLAGS) $(HUNSPELL_CFLAGS) $(WARN_CXXFLAGS) -D_ENCHANT_BUILD=1 + +hunspell_LTLIBRARIES = $(target_lib) +hunspelldir= $(libdir)/enchant + +libenchant_hunspell_lalibdir=$(libdir)/enchant +libenchant_hunspell_la_LIBADD= $(HUNSPELL_LIBS) $(ENCHANT_LIBS) $(top_builddir)/src/libenchant.la +libenchant_hunspell_la_LDFLAGS = -module -avoid-version -no-undefined + +libenchant_hunspell_la_SOURCES = \ + hunspell_checker.cpp + +EXTRA_DIST= \ + libenchant_hunspell.rc + diff --git a/src/myspell/README b/src/hunspell/README index 6b587c9..6b587c9 100644 --- a/src/myspell/README +++ b/src/hunspell/README diff --git a/src/myspell/myspell_checker.cpp b/src/hunspell/hunspell_checker.cpp index 8f4f128..145324e 100644 --- a/src/myspell/myspell_checker.cpp +++ b/src/hunspell/hunspell_checker.cpp @@ -49,7 +49,7 @@ #define MAXWORDLEN 176 #endif -ENCHANT_PLUGIN_DECLARE("Myspell") +ENCHANT_PLUGIN_DECLARE("Hunspell") #define G_ICONV_INVALID (GIConv)-1 @@ -57,11 +57,11 @@ ENCHANT_PLUGIN_DECLARE("Myspell") /***************************************************************************/ -class MySpellChecker +class HunspellChecker { public: - MySpellChecker(EnchantBroker * broker); - ~MySpellChecker(); + HunspellChecker(EnchantBroker * broker); + ~HunspellChecker(); bool checkWord (const char *word, size_t len); char **suggestWord (const char* const word, size_t len, size_t *out_n_suggs); @@ -71,12 +71,12 @@ public: private: GIConv m_translate_in; /* Selected translation from/to Unicode */ GIConv m_translate_out; - Hunspell *myspell; + Hunspell *hunspell; EnchantBroker *m_broker; }; static void -myspell_checker_free_helper (gpointer p, gpointer user _GL_UNUSED_PARAMETER) +hunspell_checker_free_helper (gpointer p, gpointer user _GL_UNUSED_PARAMETER) { g_free (p); } @@ -89,14 +89,14 @@ g_iconv_is_valid(GIConv i) return (i != G_ICONV_INVALID); } -MySpellChecker::MySpellChecker(EnchantBroker * broker) -: m_translate_in(G_ICONV_INVALID), m_translate_out(G_ICONV_INVALID), myspell(0), m_broker(broker) +HunspellChecker::HunspellChecker(EnchantBroker * broker) +: m_translate_in(G_ICONV_INVALID), m_translate_out(G_ICONV_INVALID), hunspell(0), m_broker(broker) { } -MySpellChecker::~MySpellChecker() +HunspellChecker::~HunspellChecker() { - delete myspell; + delete hunspell; if (g_iconv_is_valid (m_translate_in )) g_iconv_close(m_translate_in); if (g_iconv_is_valid(m_translate_out)) @@ -104,7 +104,7 @@ MySpellChecker::~MySpellChecker() } bool -MySpellChecker::checkWord(const char *utf8Word, size_t len) +HunspellChecker::checkWord(const char *utf8Word, size_t len) { if (len > MAXWORDLEN || !g_iconv_is_valid(m_translate_in)) return false; @@ -121,14 +121,14 @@ MySpellChecker::checkWord(const char *utf8Word, size_t len) if (static_cast<size_t>(-1) == result) return false; *out = '\0'; - if (myspell->spell(word8)) + if (hunspell->spell(word8)) return true; else return false; } char** -MySpellChecker::suggestWord(const char* const utf8Word, size_t len, size_t *nsug) +HunspellChecker::suggestWord(const char* const utf8Word, size_t len, size_t *nsug) { if (len > MAXWORDLEN || !g_iconv_is_valid(m_translate_in) @@ -149,7 +149,7 @@ MySpellChecker::suggestWord(const char* const utf8Word, size_t len, size_t *nsug *out = '\0'; char **sugMS; - *nsug = myspell->suggest(&sugMS, word8); + *nsug = hunspell->suggest(&sugMS, word8); if (*nsug > 0) { char **sug = g_new0 (char *, *nsug + 1); for (size_t i=0; i<*nsug; i++) { @@ -178,7 +178,7 @@ MySpellChecker::suggestWord(const char* const utf8Word, size_t len, size_t *nsug } static GSList * -myspell_checker_get_dictionary_dirs (EnchantBroker * broker) +hunspell_checker_get_dictionary_dirs (EnchantBroker * broker) { GSList *dirs = NULL; @@ -190,10 +190,10 @@ myspell_checker_get_dictionary_dirs (EnchantBroker * broker) for (iter = config_dirs; iter; iter = iter->next) { dirs = g_slist_append (dirs, g_build_filename (static_cast<const gchar *>(iter->data), - "myspell", nullptr)); + "hunspell", nullptr)); } - g_slist_foreach (config_dirs, myspell_checker_free_helper, nullptr); + g_slist_foreach (config_dirs, hunspell_checker_free_helper, nullptr); g_slist_free (config_dirs); } @@ -203,7 +203,7 @@ myspell_checker_get_dictionary_dirs (EnchantBroker * broker) for (iter = system_data_dirs; *iter; iter++) { - dirs = g_slist_append (dirs, g_build_filename (*iter, "myspell", "dicts", nullptr)); + dirs = g_slist_append (dirs, g_build_filename (*iter, "hunspell", "dicts", nullptr)); } } @@ -211,26 +211,26 @@ myspell_checker_get_dictionary_dirs (EnchantBroker * broker) char * enchant_prefix = enchant_get_prefix_dir(); if(enchant_prefix) { - char * myspell_prefix = g_build_filename(enchant_prefix, "share", "enchant", "myspell", nullptr); + char * hunspell_prefix = g_build_filename(enchant_prefix, "share", "enchant", "hunspell", nullptr); g_free(enchant_prefix); - dirs = g_slist_append (dirs, myspell_prefix); + dirs = g_slist_append (dirs, hunspell_prefix); } -#ifdef ENCHANT_MYSPELL_DICT_DIR - dirs = g_slist_append (dirs, g_strdup (ENCHANT_MYSPELL_DICT_DIR)); +#ifdef ENCHANT_HUNSPELL_DICT_DIR + dirs = g_slist_append (dirs, g_strdup (ENCHANT_HUNSPELL_DICT_DIR)); #endif { GSList *config_dirs, *iter; - config_dirs = enchant_get_dirs_from_param (broker, "enchant.myspell.dictionary.path"); + config_dirs = enchant_get_dirs_from_param (broker, "enchant.hunspell.dictionary.path"); for (iter = config_dirs; iter; iter = iter->next) { dirs = g_slist_append (dirs, g_strdup (static_cast<const gchar *>(iter->data))); } - g_slist_foreach (config_dirs, myspell_checker_free_helper, nullptr); + g_slist_foreach (config_dirs, hunspell_checker_free_helper, nullptr); g_slist_free (config_dirs); } @@ -248,18 +248,18 @@ myspell_checker_get_dictionary_dirs (EnchantBroker * broker) static void s_buildDictionaryDirs (std::vector<std::string> & dirs, EnchantBroker * broker) { - GSList *myspell_dirs, *iter; + GSList *hunspell_dirs, *iter; dirs.clear (); - myspell_dirs = myspell_checker_get_dictionary_dirs (broker); - for (iter = myspell_dirs; iter; iter = iter->next) + hunspell_dirs = hunspell_checker_get_dictionary_dirs (broker); + for (iter = hunspell_dirs; iter; iter = iter->next) { dirs.push_back (static_cast<const char *>(iter->data)); } - g_slist_foreach (myspell_dirs, myspell_checker_free_helper, nullptr); - g_slist_free (myspell_dirs); + g_slist_foreach (hunspell_dirs, hunspell_checker_free_helper, nullptr); + g_slist_free (hunspell_dirs); } static void @@ -311,7 +311,7 @@ static bool is_plausible_dict_for_tag(const char *dir_entry, const char *tag) } static char * -myspell_request_dictionary (EnchantBroker * broker, const char * tag) +hunspell_request_dictionary (EnchantBroker * broker, const char * tag) { std::vector<std::string> names; @@ -351,11 +351,11 @@ myspell_request_dictionary (EnchantBroker * broker, const char * tag) } bool -MySpellChecker::requestDictionary(const char *szLang) +HunspellChecker::requestDictionary(const char *szLang) { char *dic = NULL, *aff = NULL; - dic = myspell_request_dictionary (m_broker, szLang); + dic = hunspell_request_dictionary (m_broker, szLang); if (!dic) return false; @@ -364,14 +364,14 @@ MySpellChecker::requestDictionary(const char *szLang) strcpy(aff+len_dic-3, "aff"); if (g_file_test(aff, G_FILE_TEST_EXISTS)) { - myspell = new Hunspell(aff, dic); + hunspell = new Hunspell(aff, dic); } g_free(dic); g_free(aff); - if(myspell == NULL){ + if(hunspell == NULL){ return false; } - char *enc = myspell->get_dic_encoding(); + char *enc = hunspell->get_dic_encoding(); m_translate_in = g_iconv_open(enc, "UTF-8"); m_translate_out = g_iconv_open("UTF-8", enc); @@ -384,21 +384,21 @@ MySpellChecker::requestDictionary(const char *szLang) */ static char ** -myspell_dict_suggest (EnchantDict * me, const char *const word, +hunspell_dict_suggest (EnchantDict * me, const char *const word, size_t len, size_t * out_n_suggs) { - MySpellChecker * checker; + HunspellChecker * checker; - checker = static_cast<MySpellChecker *>(me->user_data); + checker = static_cast<HunspellChecker *>(me->user_data); return checker->suggestWord (word, len, out_n_suggs); } static int -myspell_dict_check (EnchantDict * me, const char *const word, size_t len) +hunspell_dict_check (EnchantDict * me, const char *const word, size_t len) { - MySpellChecker * checker; + HunspellChecker * checker; - checker = static_cast<MySpellChecker *>(me->user_data); + checker = static_cast<HunspellChecker *>(me->user_data); if (checker->checkWord(word, len)) return 0; @@ -407,7 +407,7 @@ myspell_dict_check (EnchantDict * me, const char *const word, size_t len) } static void -myspell_provider_enum_dicts (const char * const directory, +hunspell_provider_enum_dicts (const char * const directory, std::vector<std::string> & out_dicts) { GDir * dir = g_dir_open (directory, 0, nullptr); @@ -449,7 +449,7 @@ ENCHANT_MODULE_EXPORT (EnchantProvider *) init_enchant_provider (void); static char ** -myspell_provider_list_dicts (EnchantProvider * me, +hunspell_provider_list_dicts (EnchantProvider * me, size_t * out_n_dicts) { std::vector<std::string> dict_dirs, dicts; @@ -459,7 +459,7 @@ myspell_provider_list_dicts (EnchantProvider * me, for (size_t i = 0; i < dict_dirs.size(); i++) { - myspell_provider_enum_dicts (dict_dirs[i].c_str(), dicts); + hunspell_provider_enum_dicts (dict_dirs[i].c_str(), dicts); } if (dicts.size () > 0) { @@ -474,18 +474,18 @@ myspell_provider_list_dicts (EnchantProvider * me, } static void -myspell_provider_free_string_list (EnchantProvider * me _GL_UNUSED_PARAMETER, char **str_list) +hunspell_provider_free_string_list (EnchantProvider * me _GL_UNUSED_PARAMETER, char **str_list) { g_strfreev (str_list); } static EnchantDict * -myspell_provider_request_dict(EnchantProvider * me, const char *const tag) +hunspell_provider_request_dict(EnchantProvider * me, const char *const tag) { EnchantDict *dict; - MySpellChecker * checker; + HunspellChecker * checker; - checker = new MySpellChecker(me->owner); + checker = new HunspellChecker(me->owner); if (!checker) return NULL; @@ -497,26 +497,26 @@ myspell_provider_request_dict(EnchantProvider * me, const char *const tag) dict = g_new0(EnchantDict, 1); dict->user_data = (void *) checker; - dict->check = myspell_dict_check; - dict->suggest = myspell_dict_suggest; + dict->check = hunspell_dict_check; + dict->suggest = hunspell_dict_suggest; // don't implement personal, session return dict; } static void -myspell_provider_dispose_dict (EnchantProvider * me _GL_UNUSED_PARAMETER, EnchantDict * dict) +hunspell_provider_dispose_dict (EnchantProvider * me _GL_UNUSED_PARAMETER, EnchantDict * dict) { - MySpellChecker *checker; + HunspellChecker *checker; - checker = (MySpellChecker *) dict->user_data; + checker = (HunspellChecker *) dict->user_data; delete checker; g_free (dict); } static int -myspell_provider_dictionary_exists (struct str_enchant_provider * me, +hunspell_provider_dictionary_exists (struct str_enchant_provider * me, const char *const tag) { std::vector <std::string> names; @@ -536,21 +536,21 @@ myspell_provider_dictionary_exists (struct str_enchant_provider * me, } static void -myspell_provider_dispose (EnchantProvider * me) +hunspell_provider_dispose (EnchantProvider * me) { g_free (me); } static const char * -myspell_provider_identify (EnchantProvider * me _GL_UNUSED_PARAMETER) +hunspell_provider_identify (EnchantProvider * me _GL_UNUSED_PARAMETER) { - return "myspell"; + return "hunspell"; } static const char * -myspell_provider_describe (EnchantProvider * me _GL_UNUSED_PARAMETER) +hunspell_provider_describe (EnchantProvider * me _GL_UNUSED_PARAMETER) { - return "Myspell Provider"; + return "Hunspell Provider"; } EnchantProvider * @@ -559,14 +559,14 @@ init_enchant_provider (void) EnchantProvider *provider; provider = g_new0(EnchantProvider, 1); - provider->dispose = myspell_provider_dispose; - provider->request_dict = myspell_provider_request_dict; - provider->dispose_dict = myspell_provider_dispose_dict; - provider->dictionary_exists = myspell_provider_dictionary_exists; - provider->identify = myspell_provider_identify; - provider->describe = myspell_provider_describe; - provider->free_string_list = myspell_provider_free_string_list; - provider->list_dicts = myspell_provider_list_dicts; + provider->dispose = hunspell_provider_dispose; + provider->request_dict = hunspell_provider_request_dict; + provider->dispose_dict = hunspell_provider_dispose_dict; + provider->dictionary_exists = hunspell_provider_dictionary_exists; + provider->identify = hunspell_provider_identify; + provider->describe = hunspell_provider_describe; + provider->free_string_list = hunspell_provider_free_string_list; + provider->list_dicts = hunspell_provider_list_dicts; return provider; } diff --git a/src/myspell/libenchant_myspell.rc b/src/hunspell/libenchant_hunspell.rc index 75384da..d7178bc 100644 --- a/src/myspell/libenchant_myspell.rc +++ b/src/hunspell/libenchant_hunspell.rc @@ -19,12 +19,12 @@ BEGIN BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "\0"
- VALUE "FileDescription", "Libenchant Myspell module\0"
+ VALUE "FileDescription", "Libenchant Hunspell module\0"
VALUE "FileVersion", "1, 7, 0, 1\0"
- VALUE "InternalName", "libenchant_myspell\0"
+ VALUE "InternalName", "libenchant_hunspell\0"
VALUE "LegalCopyright", "Copyright \xA9 2003-2011 Joan Moratinos, Dom Lachowicz et al.\0"
VALUE "LegalTrademarks", "\0"
- VALUE "OriginalFilename", "libenchant_myspell.dll\0"
+ VALUE "OriginalFilename", "libenchant_hunspell.dll\0"
VALUE "PrivateBuild", "Dev version\0"
VALUE "ProductName", "libenchant\0"
VALUE "ProductVersion", "1, 7, 0\0"
diff --git a/src/myspell/Makefile.am b/src/myspell/Makefile.am deleted file mode 100644 index cfea67b..0000000 --- a/src/myspell/Makefile.am +++ /dev/null @@ -1,21 +0,0 @@ -if WITH_MYSPELL -target_lib = libenchant_myspell.la -else -target_lib = -endif - -AM_CPPFLAGS = -I$(top_srcdir) $(ISYSTEM)$(top_builddir)/lib $(ISYSTEM)$(top_srcdir)/lib -I$(top_srcdir)/src $(ENCHANT_CFLAGS) $(MYSPELL_CFLAGS) $(WARN_CXXFLAGS) -D_ENCHANT_BUILD=1 - -myspell_LTLIBRARIES = $(target_lib) -myspelldir= $(libdir)/enchant - -libenchant_myspell_lalibdir=$(libdir)/enchant -libenchant_myspell_la_LIBADD= $(MYSPELL_LIBS) $(ENCHANT_LIBS) $(top_builddir)/src/libenchant.la -libenchant_myspell_la_LDFLAGS = -module -avoid-version -no-undefined - -libenchant_myspell_la_SOURCES = \ - myspell_checker.cpp - -EXTRA_DIST= \ - libenchant_myspell.rc - diff --git a/tests/Makefile.am b/tests/Makefile.am index 139f963..7f95d52 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -6,7 +6,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/src $(ENCHANT_CFLAGS) # FIXME: Following line is ugly (but inserting backslashes stops it # working), and not portable to Windows (need semicolons instead of colons) AM_TESTS_ENVIRONMENT = \ - ENCHANT_MODULE_PATH=$(top_builddir)/src/applespell/$(ENCHANT_LT_OBJDIR):$(top_builddir)/src/applespell:$(top_builddir)/src/aspell/$(ENCHANT_LT_OBJDIR):$(top_builddir)/src/aspell:$(top_builddir)/src/hspell/$(ENCHANT_LT_OBJDIR):$(top_builddir)/src/hspell:$(top_builddir)/src/ispell/$(ENCHANT_LT_OBJDIR):$(top_builddir)/src/ispell:$(top_builddir)/src/myspell/$(ENCHANT_LT_OBJDIR):$(top_builddir)/src/myspell:$(top_builddir)/src/uspell/$(ENCHANT_LT_OBJDIR):$(top_builddir)/src/uspell:$(top_builddir)/src/voikko/$(ENCHANT_LT_OBJDIR):$(top_builddir)/src/voikko:$(top_builddir)/src/zemberek/$(ENCHANT_LT_OBJDIR):$(top_builddir)/src/zemberek; \ + ENCHANT_MODULE_PATH=$(top_builddir)/src/applespell/$(ENCHANT_LT_OBJDIR):$(top_builddir)/src/applespell:$(top_builddir)/src/aspell/$(ENCHANT_LT_OBJDIR):$(top_builddir)/src/aspell:$(top_builddir)/src/hspell/$(ENCHANT_LT_OBJDIR):$(top_builddir)/src/hspell:$(top_builddir)/src/ispell/$(ENCHANT_LT_OBJDIR):$(top_builddir)/src/ispell:$(top_builddir)/src/hunspell/$(ENCHANT_LT_OBJDIR):$(top_builddir)/src/hunspell:$(top_builddir)/src/uspell/$(ENCHANT_LT_OBJDIR):$(top_builddir)/src/uspell:$(top_builddir)/src/voikko/$(ENCHANT_LT_OBJDIR):$(top_builddir)/src/voikko:$(top_builddir)/src/zemberek/$(ENCHANT_LT_OBJDIR):$(top_builddir)/src/zemberek; \ export ENCHANT_MODULE_PATH; \ rm -f test.pwl; \ cp $(srcdir)/test.pwl.orig $(builddir)/test.pwl; \ diff --git a/unittests/broker/enchant_broker_set_ordering_tests.cpp b/unittests/broker/enchant_broker_set_ordering_tests.cpp index 6e1d8ea..bad4202 100644 --- a/unittests/broker/enchant_broker_set_ordering_tests.cpp +++ b/unittests/broker/enchant_broker_set_ordering_tests.cpp @@ -141,7 +141,7 @@ struct EnchantBrokerFileSetOrdering_TestFixture: EnchantBrokerSetOrdering_TestFi * enchant_broker_set_ordering
* @broker: A non-null #EnchantBroker
* @tag: A non-null language tag (en_US)
- * @ordering: A non-null ordering (aspell,myspell,ispell,uspell,hspell)
+ * @ordering: A non-null ordering (aspell,hunspell,ispell,uspell,hspell)
*
* Declares a preference of dictionaries to use for the language
* described/referred to by @tag. The ordering is a comma delimited
@@ -323,7 +323,7 @@ TEST_FIXTURE(EnchantBrokerSetOrdering_TestFixture, TEST_FIXTURE(EnchantBrokerSetOrdering_TestFixture,
EnchantBrokerSetOrdering_EmptyLanguageTag_DoNothing)
{
- enchant_broker_set_ordering(_broker, "", "aspell,myspell,ispell");
+ enchant_broker_set_ordering(_broker, "", "aspell,hunspell,ispell");
}
TEST_FIXTURE(EnchantBrokerSetOrdering_TestFixture,
|