[evolution-patches] [PATCH] Allow gnome-spell to work with pspell 0.12.x in addition to aspell 0.50



The attached patch makes it so that gnome-spell can build and work
properly with pspell 0.12.x in addition to the newer aspell 0.50. 
Having to have the defines in dictionary.c is a little ugly, but
unfortunately, I can't see a better way of handling it :(

Jeremy
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-spell/ChangeLog,v
retrieving revision 1.44
diff -u -r1.44 ChangeLog
--- ChangeLog	16 May 2003 02:45:38 -0000	1.44
+++ ChangeLog	16 May 2003 15:30:05 -0000
@@ -1,3 +1,8 @@
+2003-05-16  Jeremy Katz  <katzj redhat com>
+
+	* configure.in: If finding aspell 0.50 fails, see if pspell 0.12
+	is found and set defines appropriately to build if so.
+
 2003-05-16  Danilo Šegan  <dsegan gmx net>
 
 	* configure.in: Added "sr" and "sr Latn" to ALL_LINGUAS.
Index: configure.in
===================================================================
RCS file: /cvs/gnome/gnome-spell/configure.in,v
retrieving revision 1.65
diff -u -r1.65 configure.in
--- configure.in	16 May 2003 02:45:38 -0000	1.65
+++ configure.in	16 May 2003 15:30:05 -0000
@@ -48,7 +48,7 @@
 dnl
 dnl aspell
 dnl
-
+msg_aspell="no"
 AC_ARG_WITH(aspell-prefix, [  --with-aspell-prefix=DIR
                           specify under which prefix aspell is installed.], with_aspell_prefix="$withval", )
 
@@ -64,9 +64,30 @@
    ASPELL_LIBS="-L`aspell config prefix`/lib -laspell"
    ASPELL_DICT="`aspell config dict-dir`"
 fi
-AC_CHECK_LIB(aspell,new_aspell_config,,AC_MSG_ERROR([gnome-spell cannot be built without aspell library]),)
-if test "x$with_aspell_prefix" != "x"; then
+AC_CHECK_LIB(aspell,new_aspell_config,msg_aspell="yes (0.50)")
+if test "x$with_aspell_prefix" != "x" -o "$msg_aspell" = "no"; then
    LDFLAGS=$saved_LDFLAGS
+fi
+
+if test "$msg_aspell" = "no"; then
+   AC_MSG_CHECKING([for pspell])
+   if pspell-config version > /dev/null 2>&1; then
+        pspell_ver=`pspell-config version`
+        pspell_num=`echo ${pspell_ver} | awk 'BEGIN {FS="."}{printf $1*10000 + $2*100 + $3;}'`
+        if test ${pspell_num} -lt 1200; then
+                AC_MSG_RESULT([pspell version .12 or later required, you have ${pspell_ver} installed])
+        fi
+        ASPELL_LIBS="-lpspell -lpspell_aspell"
+	ASPELL_INC=""
+	ASPELL_DICT=""
+        AC_MSG_RESULT([found ($pspell_ver)])
+	msg_aspell="yes ($pspell_ver)"
+	AC_DEFINE_UNQUOTED(USE_PSPELL_COMPAT, 1, [Define if pspell 0.12 is being used])
+   fi
+fi
+
+if test "$msg_aspell" = "no"; then
+   AC_ERROR([no appropriate aspell or pspell version found.  gnome-spell requires pspell or aspell to build])
 fi
 
 AC_SUBST(ASPELL_DICT)
Index: gnome-spell/ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-spell/gnome-spell/ChangeLog,v
retrieving revision 1.35
diff -u -r1.35 ChangeLog
--- gnome-spell/ChangeLog	16 May 2003 12:18:18 -0000	1.35
+++ gnome-spell/ChangeLog	16 May 2003 15:30:05 -0000
@@ -1,3 +1,13 @@
+2003-05-16  Jeremy Katz  <katzj redhat com>
+
+	* dictionary.c (known_languages): Handle the fact that dictionary
+	names change between aspell versions.
+
+	* dictionary.h: #include the compat definitions if needed.
+
+	* pspell-compat.h: New file.  Adds compatibility defines for
+	building against pspell 0.12.
+
 2003-05-16  Radek Doulik  <rodo ximian com>
 
 	* dictionary.c (impl_gnome_spell_dictionary_set_language): NULL
Index: gnome-spell/dictionary.c
===================================================================
RCS file: /cvs/gnome/gnome-spell/gnome-spell/dictionary.c,v
retrieving revision 1.33
diff -u -r1.33 dictionary.c
--- gnome-spell/dictionary.c	16 May 2003 12:18:18 -0000	1.33
+++ gnome-spell/dictionary.c	16 May 2003 15:30:05 -0000
@@ -149,23 +149,44 @@
 	"ca", N_("Catalan"),
 	"cs", N_("Czech"),
 	"da", N_("Danish"),
+#ifdef USE_PSPELL_COMPAT
+	"de_de", N_("German (Germany)"),
+	"de_ch", N_("German (Swiss)"),
+#else
 	"de-DE", N_("German (Germany)"),
 	"de-CH", N_("German (Swiss)"),
+#endif
 	"el", N_("Greek"),
+#ifdef USE_PSPELL_COMPAT
+	"en_us", N_("English (American)"),
+	"en_gb", N_("English (British)"),
+	"en_ca", N_("English (Canadian)"),
+#else
 	"en-US", N_("English (American)"),
 	"en-GB", N_("English (British)"),
 	"en-CA", N_("English (Canadian)"),
+#endif
 	"eo", N_("Esperanto"),
 	"es", N_("Spanish"),
 	"fo", N_("Faroese"),
+#ifdef USE_PSPELL_COMPAT
+	"fr_fr", N_("French (France)"),
+	"fr_ch", N_("French (Swiss)"),
+#else
 	"fr-FR", N_("French (France)"),
 	"fr-CH", N_("French (Swiss)"),
+#endif
 	"it", N_("Italian"),
 	"nl", N_("Dutch"),
 	"no", N_("Norwegian"),
 	"pl", N_("Polish"),
+#ifdef USE_PSPELL_COMPAT
+	"pt_pt", N_("Portuguese (Portugal)"),
+	"pt_br", N_("Portuguese (Brazilian)"),
+#else
 	"pt-PT", N_("Portuguese (Portugal)"),
 	"pt-BR", N_("Portuguese (Brazilian)"),
+#endif
 	"ru", N_("Russian"),
 	"sk", N_("Slovak"),
 	"sv", N_("Swedish"),
Index: gnome-spell/dictionary.h
===================================================================
RCS file: /cvs/gnome/gnome-spell/gnome-spell/dictionary.h,v
retrieving revision 1.7
diff -u -r1.7 dictionary.h
--- gnome-spell/dictionary.h	20 Mar 2003 14:11:39 -0000	1.7
+++ gnome-spell/dictionary.h	16 May 2003 15:30:05 -0000
@@ -26,7 +26,11 @@
 G_BEGIN_DECLS
 
 #include <bonobo/bonobo-object.h>
+#ifndef USE_PSPELL_COMPAT
 #include <aspell.h>
+#else
+#include "pspell-compat.h"
+#endif
 
 #define GNOME_SPELL_DICTIONARY_TYPE        (gnome_spell_dictionary_get_type ())
 #define GNOME_SPELL_DICTIONARY(o)          (G_TYPE_CHECK_INSTANCE_CAST ((o), \
Index: gnome-spell/pspell-compat.h
===================================================================
RCS file: gnome-spell/pspell-compat.h
diff -N gnome-spell/pspell-compat.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnome-spell/pspell-compat.h	16 May 2003 15:30:05 -0000
@@ -0,0 +1,90 @@
+/* This file is the reverse of the compatability layer provided with aspell 
+ * 0.50.  It allows programs which use the new aspell 0.50 API to build 
+ * properly with an older 0.12 pspell library.
+ */
+
+#ifndef PSPELL_COMPAT_H
+#define PSPELL_COMPAT_H
+
+#include <pspell/pspell.h>
+
+#define AspellCanHaveError   PspellCanHaveError
+#define AspellErrorExtraInfo   PspellErrorExtraInfo
+#define aspell_error_number   pspell_error_number
+#define aspell_error_message   pspell_error_message
+#define delete_aspell_can_have_error   delete_pspell_can_have_error
+#define AspellStringEnumeration   PspellStringEmulation
+#define aspell_string_enumeration_clone   pspell_string_emulation_clone
+#define aspell_string_enumeration_assign   pspell_string_emulation_assign
+#define aspell_string_enumeration_at_end   pspell_string_emulation_at_end
+#define aspell_string_enumeration_next   pspell_string_emulation_next
+#define delete_aspell_string_enumeration   delete_pspell_string_emulation
+#define AspellStringPair   PspellStringPair
+#define AspellStringPairEnumeration   PspellStringPairEmulation
+#define aspell_string_pair_enumeration_clone   pspell_string_pair_emulation_clone
+#define aspell_string_pair_enumeration_assign   pspell_string_pair_emulation_assign
+#define aspell_string_pair_enumeration_at_end   pspell_string_pair_emulation_at_end
+#define delete_aspell_string_pair_enumeration   delete_pspell_string_pair_emulation
+#define AspellKeyInfoType   PspellKeyInfoType
+#define AspellKeyInfoString   PspellKeyInfoString
+#define AspellKeyInfoInt   PspellKeyInfoInt
+#define AspellKeyInfoBool   PspellKeyInfoBool
+#define AspellKeyInfoList   PspellKeyInfoList
+#define AspellKeyInfo   PspellKeyInfo
+#define AspellKeyInfoEnumeration   PspellKeyInfoEmulation
+#define AspellConfig   PspellConfig
+#define new_aspell_config   new_pspell_config
+#define delete_aspell_config   delete_pspell_config
+#define aspell_config_error_number   pspell_config_error_number
+#define aspell_config_error_message   pspell_config_error_message
+#define aspell_config_clone   pspell_config_clone
+#define aspell_config_assign   pspell_config_assign
+#define aspell_config_set_extra   pspell_config_set_extra
+#define aspell_config_keyinfo   pspell_config_keyinfo
+#define aspell_config_possible_elements   pspell_config_possible_elements
+#define aspell_config_get_default   pspell_config_get_default
+#define aspell_config_elements   pspell_config_elements
+#define aspell_config_replace   pspell_config_replace
+#define aspell_config_remove   pspell_config_remove
+#define aspell_config_have   pspell_config_have
+#define aspell_config_retrieve   pspell_config_retrieve
+#define aspell_config_retrieve_list   pspell_config_retrieve_list
+#define aspell_config_retrieve_bool   pspell_config_retrieve_bool
+#define aspell_config_retrieve_int   pspell_config_retrieve_int
+#define AspellStringMap;   PspellStringMap
+#define new_aspell_string_map   new_pspell_string_map
+#define delete_aspell_string_map   delete_pspell_string_map
+#define aspell_string_map_clone   pspell_string_map_clone
+#define aspell_string_map_assign   pspell_string_map_assign
+#define aspell_string_map_elements   pspell_string_map_elements
+#define aspell_string_map_insert   pspell_string_map_insert
+#define aspell_string_map_replace   pspell_string_map_replace
+#define aspell_string_map_remove   pspell_string_map_remove
+#define aspell_string_map_clear   pspell_string_map_clear
+#define aspell_string_map_lookup   pspell_string_map_lookup
+#define aspell_string_map_size   pspell_string_map_size
+#define aspell_string_map_empty   pspell_string_map_empty
+#define AspellWordList   PspellWordList
+#define aspell_word_list_encoding   pspell_word_list_encoding
+#define aspell_word_list_empty   pspell_word_list_empty
+#define aspell_word_list_size   pspell_word_list_size
+#define aspell_word_list_elements   pspell_word_list_elements
+#define AspellSpeller   PspellManager
+#define new_aspell_speller   new_pspell_manager
+#define to_aspell_speller   to_pspell_manager
+#define delete_aspell_speller   delete_pspell_manager
+#define aspell_speller_error_number   pspell_manager_error_number
+#define aspell_speller_error_message   pspell_manager_error_message
+#define aspell_speller_config   pspell_manager_config
+#define aspell_speller_main_word_list   pspell_manager_master_word_list
+#define aspell_speller_personal_word_list   pspell_manager_personal_word_list
+#define aspell_speller_session_word_list   pspell_manager_session_word_list
+#define aspell_speller_save_all_word_lists   pspell_manager_save_all_word_lists
+#define aspell_speller_clear_session   pspell_manager_clear_session
+#define aspell_speller_check   pspell_manager_check
+#define aspell_speller_add_to_personal   pspell_manager_add_to_personal
+#define aspell_speller_add_to_session   pspell_manager_add_to_session
+#define aspell_speller_suggest   pspell_manager_suggest
+#define aspell_speller_store_replacement   pspell_manager_store_replacement
+
+#endif


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]