diff --git a/scim-wnn/configure.ac b/scim-wnn/configure.ac index e65e9e1..d7eea13 100644 --- a/scim-wnn/configure.ac +++ b/scim-wnn/configure.ac @@ -89,13 +89,6 @@ fi fi -AC_CHECK_HEADER([anthy/anthy.h], [ - LIBS="$LIBS -lanthy -lanthydic" -],[]) -if echo $LIBS | grep "anthy" > /dev/null; then - AC_DEFINE([HAVE_LIBANTHY],[1],[Anthy]) -fi - # Checks for header files. AC_HEADER_STDC diff --git a/scim-wnn/m4/Makefile b/scim-wnn/m4/Makefile index b58c7ef..87e6ca4 100644 --- a/scim-wnn/m4/Makefile +++ b/scim-wnn/m4/Makefile @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.2 from Makefile.am. +# Makefile.in generated by automake 1.9.5 from Makefile.am. # m4/Makefile. Generated from Makefile.in by configure. # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. +# 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -83,7 +83,7 @@ CXX = g++ CXXCPP = g++ -E CXXDEPMODE = depmode=gcc3 -CXXFLAGS = -O3 -march=i686 -fomit-frame-pointer -fforce-addr -fexpensive-optimizations -fpeephole -fgcse -funroll-loops +CXXFLAGS = -g -O2 CYGPATH_W = echo DATADIRNAME = share DEFS = -DHAVE_CONFIG_H @@ -115,12 +115,12 @@ INTLLIBS = INTLOBJS = INTL_LIBTOOL_SUFFIX_PREFIX = -LDFLAGS = -z combreloc +LDFLAGS = LIBADD_DL = -ldl LIBICONV = LIBINTL = LIBOBJS = -LIBS = -lwnn -lcrypt -lanthy -lanthydic +LIBS = -lwnn -lcrypt LIBTOOL = $(SHELL) $(top_builddir)/libtool LIBTOOL_DEPS = ./ltmain.sh LN_S = ln -s diff --git a/scim-wnn/m4/Makefile.in b/scim-wnn/m4/Makefile.in index 8e68db6..d54cb86 100644 --- a/scim-wnn/m4/Makefile.in +++ b/scim-wnn/m4/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.2 from Makefile.am. +# Makefile.in generated by automake 1.9.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. +# 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. diff --git a/scim-wnn/src/Makefile.am b/scim-wnn/src/Makefile.am index 4071a9f..e3e6f99 100644 --- a/scim-wnn/src/Makefile.am +++ b/scim-wnn/src/Makefile.am @@ -26,13 +26,13 @@ -DSCIM_WNN_ICON_FILE=\"@SCIM_ICONDIR@/scim-wnn.png\" noinst_HEADERS = scim_wnn_imengine.h wnnproto.h romkan.h romkan_table.h \ - wnnconversion.h scim_wnn_def.h preeditor.h kanainput.h convertor.h anthyconversion.h + wnnconversion.h scim_wnn_def.h preeditor.h kanainput.h convertor.h moduledir = @SCIM_MODULEDIR@/IMEngine module_LTLIBRARIES = wnn.la wnn_la_SOURCES = scim_wnn_imengine.cpp romkan.cpp wnnconversion.cpp \ - preeditor.cpp kanainput.cpp convertor.cpp anthyconversion.cpp + preeditor.cpp kanainput.cpp convertor.cpp wnn_la_CFLAGS = @SCIM_CFLAGS@ @SCIM_DEBUG_FLAGS@ wnn_la_CXXFLAGS = @SCIM_CFLAGS@ @SCIM_DEBUG_FLAGS@ diff --git a/scim-wnn/src/anthyconversion.cpp b/scim-wnn/src/anthyconversion.cpp deleted file mode 100644 index 3651530..0000000 --- a/scim-wnn/src/anthyconversion.cpp +++ /dev/null @@ -1,171 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2004 by TAM(Teppei Tamra) * - * tam-t@par.odn.ne.jp * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU 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. * - ***************************************************************************/ -#include "anthyconversion.h" - -#ifdef HAVE_LIBANTHY - - -AnthyConversion::AnthyConversion(ConfigPointer cfg) : Convertor(cfg) -{ - m_iconv.set_encoding ("EUC-JP"); - pos = 0; - anthy_init(); - context = anthy_create_context(); -} - - -AnthyConversion::~AnthyConversion() -{ -} - -bool AnthyConversion::isConnected() { - return(true); -} - -void AnthyConversion::reset(){ - anthy_init(); - context = anthy_create_context(); - return; -} - -void AnthyConversion::setYomiText(WideString yomi) { - yomiText = yomi; -} - -int AnthyConversion::ren_conversion() { - String y; - m_iconv.convert(y,yomiText); - anthy_set_string(context,y.c_str()); - struct anthy_conv_stat stat; - anthy_get_stat(context,&stat); - pos = 0; - buildResult(); - - return(stat.nr_segment); -} - -WideString AnthyConversion::getText() { - WideString text; - for(unsigned int i = 0;i < convResult.size();i ++) { - text += convResult[i].kouho[convResult[i].pos]; - } - return(text); -} - -int AnthyConversion::setPos(int p){ - if ((p < convResult.size()) && (p >= 0)) pos = p; - return(pos); -} - -int AnthyConversion::getPos() { - return(pos); -} - -ResultList AnthyConversion::getResultList(int p,int kt){ - if (p == -1) p = pos; - if ((kt != 0) || (p >= convResult.size())) return(ResultList()); - return(convResult[p]); -} - -ResultList AnthyConversion::getYosokuList(const WideString &str) { - return(ResultList()); -} - -bool AnthyConversion::select(int p) { - if (p < convResult[pos].count) { - convResult[pos].pos = p; - } -} - -AttributeList AnthyConversion::getAttributeList() { - AttributeList attr; - int l = 0; - for(unsigned int i = 0;i < convResult.size();i ++) { - if (pos == i) { - Attribute a(l,convResult[i].kouho[convResult[i].pos].length(),SCIM_ATTR_DECORATE,SCIM_ATTR_DECORATE_REVERSE); - attr.push_back(a); - } - l += convResult[i].kouho[convResult[i].pos].length(); - } - return(attr); -} - -bool AnthyConversion::resizeRegion(int w) { - if ((convResult[pos].kouho[convResult[pos].pos].length() + w) < 1) return(false); - if ((pos >= (convResult.size() - 1)) && (w > 0)) return(false); - anthy_resize_segment(context,pos,w); - buildResult(); - return(true); -} - -void AnthyConversion::updateFrequency() { - for(unsigned int i = 0;i < convResult.size();i ++) { - anthy_commit_segment(context,i,convResult[i].pos); - } - return; -} - -bool AnthyConversion::connect() { - return(true); -} -void AnthyConversion::disconnect() { - return; -} - -int AnthyConversion::getCaretPos() { - int l = 0; - for(unsigned int i = 0;i < convResult.size();i ++) { - if (pos == i) return(l); - l += convResult[i].kouho[convResult[i].pos].length(); - } - return(0); -} - -void AnthyConversion::buildResult() { - struct anthy_conv_stat stat; - anthy_get_stat(context,&stat); - convResult.clear(); - for(int i = 0;i < stat.nr_segment;i ++) { - ResultList l; - l.kType = 0; - struct anthy_segment_stat sstat; - anthy_get_segment_stat(context,0,&sstat); - l.count = sstat.nr_candidate; - l.pos = 0; - for(int j = 0;j < sstat.nr_candidate;j ++) { - char res[256]; - int c = anthy_get_segment(context,i,j,0,0); - if (c > 255) c = 255; - anthy_get_segment(context,i,j,res,c + 1); - WideString w; - m_iconv.convert(w,String(res)); - l.kouho.push_back(w); - } - convResult.push_back(l); - } -} - -String AnthyConversion::getName() -{ - return(String("Anthy")); -} - -#endif - diff --git a/scim-wnn/src/anthyconversion.h b/scim-wnn/src/anthyconversion.h deleted file mode 100644 index 5cdc83d..0000000 --- a/scim-wnn/src/anthyconversion.h +++ /dev/null @@ -1,82 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2004 by TAM(Teppei Tamra) * - * tam-t@par.odn.ne.jp * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU 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. * - ***************************************************************************/ -#ifndef ANTHYCONVERSION_H -#define ANTHYCONVERSION_H - -#ifdef HAVE_CONFIG_H -#include -#endif - -#ifdef HAVE_LIBANTHY - -#define Uses_SCIM_CONFIG_BASE - -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace std; -using namespace scim; - -/** -@author TAM (Teppei Tamra) -*/ -class AnthyConversion : public Convertor { -public: - AnthyConversion(ConfigPointer cfg); - - ~AnthyConversion(); - virtual bool isConnected(); - virtual void reset(); - virtual void setYomiText(WideString yomi); - virtual int ren_conversion(); - virtual WideString getText(); - virtual int setPos(int p); - virtual int getPos(); - virtual ResultList getResultList(int p = -1 ,int kt = 0); - virtual ResultList getYosokuList(const WideString &str); - virtual bool select(int p); - virtual AttributeList getAttributeList(); - virtual bool resizeRegion(int w); - virtual void updateFrequency(); - virtual bool connect(); - virtual void disconnect(); - virtual int getCaretPos(); - virtual String getName(); - -protected: - void buildResult(); -protected: - anthy_context_t context; - IConvert m_iconv; - WideString yomiText; - vector convResult; - int pos; - -}; - -#endif - -#endif diff --git a/scim-wnn/src/convertor.h b/scim-wnn/src/convertor.h index bc23d47..11ba9a7 100644 --- a/scim-wnn/src/convertor.h +++ b/scim-wnn/src/convertor.h @@ -29,6 +29,7 @@ #include #include + using namespace std; using namespace scim; @@ -73,4 +74,5 @@ }; + #endif diff --git a/scim-wnn/src/kanainput.cpp b/scim-wnn/src/kanainput.cpp index 0e40ab7..25d6b9e 100644 --- a/scim-wnn/src/kanainput.cpp +++ b/scim-wnn/src/kanainput.cpp @@ -37,6 +37,7 @@ #define bind_textdomain_codeset(domain,codeset) #endif + struct KanaInputKey { int code; const char kana[6]; diff --git a/scim-wnn/src/scim_wnn_imengine.cpp b/scim-wnn/src/scim_wnn_imengine.cpp index fd0bc55..3c6b22f 100644 --- a/scim-wnn/src/scim_wnn_imengine.cpp +++ b/scim-wnn/src/scim_wnn_imengine.cpp @@ -181,6 +181,7 @@ WnnInstance::WnnInstance (WnnFactory *factory, const String& encoding, int id) : IMEngineInstanceBase (factory, encoding, id) { + SCIM_DEBUG_IMENGINE(1) << "!!! WNNINSTANCE !!!\n"; m_iconv.set_encoding ("EUC-JP"); preeditors.push_back(new Romkan(_scim_config)); preeditors.push_back(new KanaInput(_scim_config)); @@ -216,12 +217,7 @@ sType = _scim_config->read(String(SCIM_CONFIG_WNN_SERVERTYPE),String(SCIM_DEFAULT_WNN_SERVERTYPE)); if (wnn) delete(wnn); - #ifdef HAVE_LIBANTHY - if (sType == "Anthy") - wnn = new AnthyConversion(_scim_config); - else - #endif - wnn = new WnnConversion(_scim_config); + wnn = new WnnConversion(_scim_config); defaultPreEditor = _scim_config->read(String(SCIM_CONFIG_WNN_DEFAULT_PREEDITOR),String(SCIM_DEFAULT_WNN_DEFAULT_PREEDITOR)); diff --git a/scim-wnn/src/scim_wnn_imengine.h b/scim-wnn/src/scim_wnn_imengine.h index aa866c0..47d3a5b 100644 --- a/scim-wnn/src/scim_wnn_imengine.h +++ b/scim-wnn/src/scim_wnn_imengine.h @@ -26,7 +26,6 @@ #include #include #include -#include #define Uses_SCIM_ICONV #include #include