diff options
author | Reuben Thomas <rrt@sc3d.org> | 2017-02-18 19:13:24 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-18 19:13:24 +0000 |
commit | 343582102da129599654eaab944c24a3201a921a (patch) | |
tree | ee1ec5ae467a4f93cd9a1f29e667d35f820394cb | |
parent | 7e263df7319fb4ce59617600e6ced416c13dfa3e (diff) | |
parent | ab8cb763aed639667bc627adc420ba3624be7862 (diff) | |
download | enchant-343582102da129599654eaab944c24a3201a921a.tar.gz |
Merge pull request #84 from rrthomas/master
Remove some macOS-specific code
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/enchant.c | 14 | ||||
-rw-r--r-- | src/enchant_cocoa.h | 50 | ||||
-rw-r--r-- | src/enchant_cocoa.m | 83 | ||||
-rw-r--r-- | src/ispell/ispell_checker.cpp | 20 | ||||
-rw-r--r-- | src/myspell/myspell_checker.cpp | 8 | ||||
-rw-r--r-- | src/uspell/uspell_provider.cpp | 13 | ||||
-rw-r--r-- | unittests/EnchantTestFixture.h | 11 | ||||
-rw-r--r-- | unittests/broker/enchant_broker_request_pwl_dict_tests.cpp | 6 |
10 files changed, 11 insertions, 198 deletions
diff --git a/configure.ac b/configure.ac index daa51d6..93d1357 100644 --- a/configure.ac +++ b/configure.ac @@ -507,7 +507,7 @@ if test "x$check_applespell" = "xyes"; then AC_ARG_ENABLE(applespell, AS_HELP_STRING([--disable-applespell],[enable the applespell backend @<:@default=no@:>@]), build_applespell="$enableval", build_applespell=no) if test "x$build_applespell" != "xno"; then - APPLESPELL_CFLAGS+=" -DXP_TARGET_COCOA -xobjective-c" + APPLESPELL_CFLAGS+=" -xobjective-c" APPLESPELL_LIBS+=" -lobjc" APPLESPELL_LDFLAGS+=" -framework Cocoa" fi diff --git a/src/Makefile.am b/src/Makefile.am index 17cf8c2..deedb5b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -23,8 +23,6 @@ if WITH_APPLESPELL AM_CPPFLAGS += @APPLESPELL_CFLAGS@ libenchant_la_LIBADD += @APPLESPELL_LIBS@ libenchant_la_LDFLAGS += @APPLESPELL_LDFLAGS@ -libenchant_la_SOURCES += enchant_cocoa.m enchant_cocoa.h -libenchant_include_HEADERS += enchant_cocoa.h endif EXTRA_DIST=enchant.i diff --git a/src/enchant.c b/src/enchant.c index 1d3c622..164e60a 100644 --- a/src/enchant.c +++ b/src/enchant.c @@ -42,11 +42,7 @@ #include "enchant-provider.h" #include "pwl.h" -#ifdef XP_TARGET_COCOA -#import "enchant_cocoa.h" -#endif - -#ifdef XP_TARGET_COCOA +#if defined(__APPLE__) && defined(__MACH__) #define ENCHANT_USER_PATH_EXTENSION "Library", "Application Support", "Enchant" #elif defined(_WIN32) #define ENCHANT_USER_PATH_EXTENSION "enchant" @@ -211,10 +207,6 @@ enchant_get_module_dirs (void) char * module_dir = NULL; char * prefix = NULL; -#ifdef XP_TARGET_COCOA - module_dirs = enchant_slist_append_unique_path (module_dirs, g_strdup ([[EnchantResourceProvider instance] moduleFolder])); -#endif - { GSList *user_dirs, *iter; @@ -272,10 +264,6 @@ enchant_get_conf_dirs (void) g_slist_free (user_conf_dirs); -#ifdef XP_TARGET_COCOA - conf_dirs = enchant_slist_append_unique_path (conf_dirs, g_strdup ([[EnchantResourceProvider instance] configFolder])); -#endif - /* Dynamically locate library and search for files relative to it. */ prefix = enchant_get_prefix_dir(); if(prefix) diff --git a/src/enchant_cocoa.h b/src/enchant_cocoa.h deleted file mode 100644 index 1b86417..0000000 --- a/src/enchant_cocoa.h +++ /dev/null @@ -1,50 +0,0 @@ -/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* enchant - * Copyright (C) 2004 Francis James Franklin - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02110-1301, USA. - * - * In addition, as a special exception, Dom Lachowicz - * gives permission to link the code of this program with - * non-LGPL Spelling Provider libraries (eg: a MSFT Office - * spell checker backend) and distribute linked combinations including - * the two. You must obey the GNU Lesser General Public License in all - * 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. - */ - -#ifndef ENCHANT_COCOA_H -#define ENCHANT_COCOA_H - -#import <Cocoa/Cocoa.h> - -@interface EnchantResourceProvider : NSObject -{ - NSString * ModuleFolder; - NSString * ConfigFolder; -} -+ (EnchantResourceProvider *)instance; - -- (id)init; -- (void)dealloc; - -- (const char *)moduleFolder; -- (const char *)configFolder; -@end - -#endif /* ENCHANT_COCOA_H */ diff --git a/src/enchant_cocoa.m b/src/enchant_cocoa.m deleted file mode 100644 index 31dba02..0000000 --- a/src/enchant_cocoa.m +++ /dev/null @@ -1,83 +0,0 @@ -/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* enchant - * Copyright (C) 2004 Francis James Franklin - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02110-1301, USA. - * - * In addition, as a special exception, Dom Lachowicz - * gives permission to link the code of this program with - * non-LGPL Spelling Provider libraries (eg: a MSFT Office - * spell checker backend) and distribute linked combinations including - * the two. You must obey the GNU Lesser General Public License in all - * 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. - */ - -#import "enchant_cocoa.h" - -static EnchantResourceProvider * s_instance = 0; - -@implementation EnchantResourceProvider - -+ (EnchantResourceProvider *)instance -{ - if (!s_instance) - { - s_instance = [[EnchantResourceProvider alloc] init]; - } - return s_instance; -} - -- (id)init -{ - if (self = [super init]) - { - ModuleFolder = [[NSBundle bundleForClass:[self class]] resourcePath]; - [ModuleFolder retain]; - - ConfigFolder = [[NSString alloc] initWithUTF8String:"/Library/Application Support/Enchant"]; - } - return self; -} - -- (void)dealloc -{ - if (ModuleFolder) - { - [ModuleFolder release]; - ModuleFolder = 0; - } - if (ConfigFolder) - { - [ConfigFolder release]; - ConfigFolder = 0; - } - [super dealloc]; -} - -- (const char *)moduleFolder -{ - return [ModuleFolder UTF8String]; -} - -- (const char *)configFolder -{ - return [ConfigFolder UTF8String]; -} - -@end diff --git a/src/ispell/ispell_checker.cpp b/src/ispell/ispell_checker.cpp index 6b86537..38b144f 100644 --- a/src/ispell/ispell_checker.cpp +++ b/src/ispell/ispell_checker.cpp @@ -292,32 +292,14 @@ ispell_checker_get_dictionary_dirs (EnchantBroker * broker) g_slist_free (config_dirs); } -#if 0 - { - const gchar* const * system_data_dirs = g_get_system_data_dirs (); - const gchar* const * iter; - - for (iter = system_data_dirs; *iter; iter++) - { - dirs = g_slist_append (dirs, g_build_filename (*iter, "ispell", "dicts", NULL)); - } - } -#endif - - /* until I work out how to link the modules against enchant in MacOSX - fjf - */ -#ifndef XP_TARGET_COCOA - char * ispell_prefix = NULL; - /* Dynamically locate library and search for modules relative to it. */ char * enchant_prefix = enchant_get_prefix_dir(); if(enchant_prefix) { - ispell_prefix = g_build_filename(enchant_prefix, "share", "enchant", "ispell", NULL); + char * ispell_prefix = g_build_filename(enchant_prefix, "share", "enchant", "ispell", NULL); g_free(enchant_prefix); dirs = g_slist_append (dirs, ispell_prefix); } -#endif #ifdef ENCHANT_ISPELL_DICT_DIR dirs = g_slist_append (dirs, g_strdup (ENCHANT_ISPELL_DICT_DIR)); diff --git a/src/myspell/myspell_checker.cpp b/src/myspell/myspell_checker.cpp index f105341..df9683e 100644 --- a/src/myspell/myspell_checker.cpp +++ b/src/myspell/myspell_checker.cpp @@ -198,20 +198,14 @@ myspell_checker_get_dictionary_dirs (EnchantBroker * broker) } } - /* until I work out how to link the modules against enchant in MacOSX - fjf - */ -#ifndef XP_TARGET_COCOA - char * myspell_prefix = NULL; - /* Dynamically locate library and search for modules relative to it. */ char * enchant_prefix = enchant_get_prefix_dir(); if(enchant_prefix) { - myspell_prefix = g_build_filename(enchant_prefix, "share", "enchant", "myspell", NULL); + char * myspell_prefix = g_build_filename(enchant_prefix, "share", "enchant", "myspell", NULL); g_free(enchant_prefix); dirs = g_slist_append (dirs, myspell_prefix); } -#endif #ifdef ENCHANT_MYSPELL_DICT_DIR dirs = g_slist_append (dirs, g_strdup (ENCHANT_MYSPELL_DICT_DIR)); diff --git a/src/uspell/uspell_provider.cpp b/src/uspell/uspell_provider.cpp index 0b3cf80..eefbdb5 100644 --- a/src/uspell/uspell_provider.cpp +++ b/src/uspell/uspell_provider.cpp @@ -80,25 +80,14 @@ uspell_checker_get_dictionary_dirs (EnchantBroker * broker) } } - /* until I work out how to link the modules against enchant in MacOSX - fjf - */ -#ifndef XP_TARGET_COCOA - char * uspell_prefix = NULL; - - /* Look for explicitly set registry values */ - uspell_prefix = enchant_get_registry_value ("Uspell", "Data_Dir"); - if (uspell_prefix) - dirs = g_slist_append (dirs, uspell_prefix); - /* Dynamically locate library and search for modules relative to it. */ char * enchant_prefix = enchant_get_prefix_dir(); if(enchant_prefix) { - uspell_prefix = g_build_filename(enchant_prefix, "share", "enchant", "uspell", NULL); + char * uspell_prefix = g_build_filename(enchant_prefix, "share", "enchant", "uspell", NULL); g_free(enchant_prefix); dirs = g_slist_append (dirs, uspell_prefix); } -#endif #ifdef ENCHANT_USPELL_DICT_DIR dirs = g_slist_append (dirs, g_strdup (ENCHANT_USPELL_DICT_DIR)); diff --git a/unittests/EnchantTestFixture.h b/unittests/EnchantTestFixture.h index 38e8a13..4725ef1 100644 --- a/unittests/EnchantTestFixture.h +++ b/unittests/EnchantTestFixture.h @@ -226,21 +226,18 @@ struct EnchantTestFixture static std::string GetEnchantHomeDirFromBase(const std::string& basePath)
{
-#ifdef XP_TARGET_COCOA
- return AddToPath(AddToPath(AddToPath(basePath,"Library"),
- "Application Support"),
- "Enchant");
-#else
return AddToPath(basePath, "enchant");
-#endif
}
static std::string GetEnchantHomeDirFromHome(const std::string& homePath)
{
-#ifdef XP_TARGET_COCOA
+ // FIXME: Integrate with ENCHANT_USER_PATH_EXTENSION in enchant.c
+#if defined(__APPLE__) && defined(__MACH__)
return AddToPath(AddToPath(AddToPath(homePath,"Library"),
"Application Support"),
"Enchant");
+#elif defined(_WIN32)
+ return AddToPath(homePath, "enchant");
#else
return AddToPath(homePath, ".enchant");
#endif
diff --git a/unittests/broker/enchant_broker_request_pwl_dict_tests.cpp b/unittests/broker/enchant_broker_request_pwl_dict_tests.cpp index 2502a82..f2abab6 100644 --- a/unittests/broker/enchant_broker_request_pwl_dict_tests.cpp +++ b/unittests/broker/enchant_broker_request_pwl_dict_tests.cpp @@ -117,18 +117,16 @@ TEST_FIXTURE(EnchantBrokerRequestPwlDictionary_TestFixture, CHECK_EQUAL((void*)NULL, _dict);
}
+#if defined(_WIN32)
+// Colon is illegal for Windows but okay for Linux and macOS;
TEST_FIXTURE(EnchantBrokerRequestPwlDictionary_TestFixture,
EnchantBrokerRequestPwlDictionary_IllegalFilename_NULL)
{
- // Colon is illegal for Windows and Mac but okay for Linux;
-#if defined(XP_TARGET_COCOA) || defined(_WIN32)
_dict = enchant_broker_request_pwl_dict(_broker, ":");
CHECK(!_dict);
CHECK((void*)enchant_broker_get_error(_broker));
-#endif
}
-#if defined(_WIN32)
TEST_FIXTURE(EnchantBrokerRequestPwlDictionary_TestFixture,
EnchantBrokerRequestPwlDictionary_IllegalUtf8InFilename_NULL)
{
|