diff -uNrBw scim-1.4.7.orig/src/Makefile.am scim-1.4.7/src/Makefile.am --- scim-1.4.7.orig/src/Makefile.am 2007-06-26 23:31:38.000000000 +0900 +++ scim-1.4.7/src/Makefile.am 2009-02-03 12:25:28.000000000 +0900 @@ -96,7 +96,6 @@ lib_LTLIBRARIES = libscim@SCIM_EPOCH@.la libscim@SCIM_EPOCH@_la_SOURCES = scim_backend.cpp \ - scim_chartraits.cpp \ scim_compose_key.cpp \ scim_config_base.cpp \ scim_config_module.cpp \ diff -uNrBw scim-1.4.7.orig/src/Makefile.in scim-1.4.7/src/Makefile.in --- scim-1.4.7.orig/src/Makefile.in 2007-06-26 23:41:16.000000000 +0900 +++ scim-1.4.7/src/Makefile.in 2009-02-03 12:30:50.000000000 +0900 @@ -82,7 +82,7 @@ am_libltdlc_la_OBJECTS = ltdl.lo libltdlc_la_OBJECTS = $(am_libltdlc_la_OBJECTS) libscim@SCIM_EPOCH@_la_DEPENDENCIES = libltdlc.la -am_libscim@SCIM_EPOCH@_la_OBJECTS = scim_backend.lo scim_chartraits.lo \ +am_libscim@SCIM_EPOCH@_la_OBJECTS = scim_backend.lo \ scim_compose_key.lo scim_config_base.lo scim_config_module.lo \ scim_connection.lo scim_debug.lo scim_event.lo scim_filter.lo \ scim_filter_module.lo scim_filter_manager.lo scim_frontend.lo \ @@ -461,7 +461,6 @@ @SCIM_LD_VERSION_SCRIPT_TRUE@LD_VERSION_SCRIPT_OPTION = "-Wl,--version-script=$(srcdir)/libscim.version-script" lib_LTLIBRARIES = libscim@SCIM_EPOCH@.la libscim@SCIM_EPOCH@_la_SOURCES = scim_backend.cpp \ - scim_chartraits.cpp \ scim_compose_key.cpp \ scim_config_base.cpp \ scim_config_module.cpp \ @@ -674,7 +673,6 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ltdl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scim.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scim_backend.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scim_chartraits.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scim_compose_key.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scim_config_agent.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scim_config_base.Plo@am__quote@ diff -uNrBw scim-1.4.7.orig/src/scim_chartraits.cpp scim-1.4.7/src/scim_chartraits.cpp --- scim-1.4.7.orig/src/scim_chartraits.cpp 2007-06-26 23:31:38.000000000 +0900 +++ scim-1.4.7/src/scim_chartraits.cpp 1970-01-01 09:00:00.000000000 +0900 @@ -1,172 +0,0 @@ -/** @file scim_chartraits.cpp - */ - -/* - * Smart Common Input Method - * - * Copyright (c) 2002-2005 James Su - * - * - * 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 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 program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - * - * $Id: scim_chartraits.cpp,v 1.12 2005/07/05 16:18:17 suzhe Exp $ - */ - -#include -#include "scim_types.h" - -using namespace scim; - -#define GCC_VERSION (__GNUC__ * 10000 \ - + __GNUC_MINOR__ * 100 \ - + __GNUC_PATCHLEVEL__) - -#if !defined(__STDC_ISO_10646__) && GCC_VERSION >= 30200 - -namespace std -{ - -template<> -void -char_traits::assign(char_type& __c1, const char_type& __c2) -{ - __c1 = __c2; -} - -template<> -bool -char_traits::eq(const char_type& __c1, const char_type& __c2) -{ - return __c1 == __c2; -} - -template<> -bool -char_traits::lt(const char_type& __c1, const char_type& __c2) -{ - return __c1 < __c2; -} - -template<> -char_traits::char_type* -char_traits::assign(char_type* __s, size_t __n, char_type __a) -{ - char_type* dest = __s; - while (__n-- > 0) - *(dest++) = __a; - return __s; -} - -template<> -char_traits::char_type* -char_traits::copy(char_type* __s1, const char_type* __s2, size_t __n) -{ - char_type* dest = __s1; - const char_type* from = __s2; - while (__n-- > 0) - *(dest++) = *(from++); - return __s1; -} - -template<> -char_traits::char_type* -char_traits::move(char_type* __s1, const char_type* __s2, size_t __n) -{ - if (__s1 + __n > __s2) { - char_type* dest = __s1 + __n - 1; - const char_type* from = __s2; - while (__n-- > 0) - *(dest--) = *(from++); - return __s1; - } else { - return copy(__s1, __s2, __n); - } -} - -template<> -size_t -char_traits::length(const char_type* __s) -{ - size_t __result = 0; - while ( *(__s++) != 0 ) - __result++; - return __result; -} - -template<> -int -char_traits::compare(const char_type* __s1, const char_type* __s2, size_t __n) -{ - while ( (*__s1 == *__s2++) && __n-- > 0 ) - if (*__s1++ == 0) - return (0); - if (__n <= 0) return (0); - return ( *__s1 - *(__s2 - 1) ); -} - -template<> -const char_traits::char_type* -char_traits::find(const char_type* __s, size_t __n, const char_type& __a) -{ - while (__n-- > 0) { - if (*__s == __a) - return __s; - ++__s; - } - return 0; -} - -template<> -char_traits::char_type -char_traits::to_char_type (const int_type& __c) -{ - return static_cast(__c); -} - -template<> -char_traits::int_type -char_traits::to_int_type (const char_type& __c) -{ - return static_cast(__c); -} - -template<> -bool -char_traits::eq_int_type(const int_type& __c1, const int_type& __c2) -{ - return __c1 == __c2; -} - -template<> -char_traits::int_type -char_traits::eof () -{ - return static_cast(EOF); -} - -template<> -char_traits::int_type -char_traits::not_eof (const int_type& __c) -{ - return (__c == eof()) ? 0 : __c; -} - -} -#endif - -/* -vi:ts=4:nowrap:ai:expandtab -*/ diff -uNrBw scim-1.4.7.orig/src/scim_types.h scim-1.4.7/src/scim_types.h --- scim-1.4.7.orig/src/scim_types.h 2007-06-26 23:49:15.000000000 +0900 +++ scim-1.4.7/src/scim_types.h 1970-01-01 09:00:00.000000000 +0900 @@ -1,63 +0,0 @@ -/** @file scim_types.h - * @brief defines some basic data types. - */ - -/* - * Smart Common Input Method - * - * Copyright (c) 2002-2004 James Su - * - * - * 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 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 program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - * - * $Id: scim_types.h.in,v 1.2.4.1 2007/04/10 09:18:27 suzhe Exp $ - */ - - -#ifndef __SCIM_TYPES_H -#define __SCIM_TYPES_H - -#include - -#ifdef __FreeBSD__ -# include -# if __FreeBSD_version > 500035 -# define __STDC_ISO_10646__ -# endif -#endif - -namespace scim { - -typedef uint16_t uint16; -typedef uint32_t uint32; -typedef uint64_t uint64; - -#ifdef __STDC_ISO_10646__ - typedef wchar_t ucs4_t; -#else - typedef uint32 ucs4_t; -#endif - -typedef std::basic_string String; -typedef std::basic_string WideString; - -} // namespace scim - -#endif //__SCIM_TYPES_H - -/* -vi:ts=4:nowrap:ai:expandtab -*/ diff -uNrBw scim-1.4.7.orig/src/scim_types.h.in scim-1.4.7/src/scim_types.h.in --- scim-1.4.7.orig/src/scim_types.h.in 2007-06-26 23:31:38.000000000 +0900 +++ scim-1.4.7/src/scim_types.h.in 2009-02-03 13:07:13.000000000 +0900 @@ -31,13 +31,7 @@ #define __SCIM_TYPES_H @INCLUDE_STDINT@ - -#ifdef __FreeBSD__ -# include -# if __FreeBSD_version > 500035 -# define __STDC_ISO_10646__ -# endif -#endif +#include namespace scim { @@ -51,6 +45,136 @@ typedef uint32 ucs4_t; #endif +} // namespace scim + +#ifndef __STDC_ISO_10646__ +#include + +namespace std +{ + +template<> +struct char_traits +{ + +typedef scim::ucs4_t char_type; +typedef scim::ucs4_t int_type; +typedef streampos pos_type; +typedef streamoff off_type; +typedef mbstate_t state_type; + +static void +assign(char_type& __c1, const char_type& __c2) +{ + __c1 = __c2; +} + +static bool +eq(const char_type& __c1, const char_type& __c2) +{ + return __c1 == __c2; +} + +static bool +lt(const char_type& __c1, const char_type& __c2) +{ + return __c1 < __c2; +} + +static char_type* +assign(char_type* __s, size_t __n, char_type __a) +{ + while (__n-- > 0) + assign(__s[__n], __a); + return __s; +} + +static char_type* +copy(char_type* __s1, const char_type* __s2, size_t __n) +{ + return static_cast + (memcpy(__s1, __s2, __n * sizeof(char_type))); +} + +static char_type* +move(char_type* __s1, const char_type* __s2, size_t __n) +{ + return static_cast + (memmove(__s1, __s2, __n * sizeof(char_type))); +} + +static size_t +length(const char_type* __s) +{ + const char_type *__p; + + __p = __s; + while (eq(*__p, static_cast(0))) + ++__p; + return static_cast(__p - __s); +} + +static int +compare(const char_type* __s1, const char_type* __s2, size_t __n) +{ + size_t __i; + + for (__i = 0; __i < __n; ++__i) + if (!eq(__s1[__i], __s2[__i])) + return lt(__s1[__i], __s2[__i]) ? -1 : 1; + return 0; +} + +static const char_type* +find(const char_type* __s, size_t __n, const char_type& __a) +{ + while (__n-- > 0) { + if (eq(*__s, __a)) + return __s; + ++__s; + } + return 0; +} + +static bool +eq_int_type(const int_type& __c1, const int_type& __c2) +{ + return __c1 == __c2; +} + +static char_type +to_char_type(const int_type& __c) +{ + return static_cast(__c); +} + +static int_type +to_int_type(const char_type& __c) +{ + return static_cast(__c); +} + +static int_type +eof() +{ + return static_cast(-1); +} + +static int_type +not_eof(const int_type& __c) +{ + return eq_int_type(__c, eof()) + ? static_cast(0) : __c; +} + +}; // struct char_traits + +} // namespace std + +#endif //!__STDC_ISO_10646__ + +namespace scim { + typedef std::basic_string String; typedef std::basic_string WideString;