diff options
author | Hiroshi Sumita <hsumita@google.com> | 2012-03-27 22:31:27 +0900 |
---|---|---|
committer | Hiroshi Sumita <hsumita@google.com> | 2012-03-27 22:31:27 +0900 |
commit | f340adf7daec223959ba4144cff4d85852d4ed13 (patch) | |
tree | a9d078cca3adc5b3ba1ef22ccb482de23345fd8e | |
parent | ca11abda32b0f0ba907d6597f87094514543b399 (diff) | |
download | pyzy-f340adf7daec223959ba4144cff4d85852d4ed13.tar.gz |
Make libpyzy to work on Linux.
BUG=None
TEST=Builds manually.
Review URL: https://codereview.appspot.com/5903060
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | configure.ac | 12 | ||||
-rw-r--r-- | data/db/android/Makefile.am | 2 | ||||
-rw-r--r-- | data/db/open-phrase/Makefile.am | 4 | ||||
-rw-r--r-- | pyzy-1.0.pc.in | 2 | ||||
-rw-r--r-- | pyzy.spec.in | 8 | ||||
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/PyZyDatabase.cc | 11 | ||||
-rw-r--r-- | src/PyZyInputContext.cc | 11 | ||||
-rw-r--r-- | src/PyZySpecialPhraseTable.cc | 2 | ||||
-rw-r--r-- | src/PyZyString.h | 5 | ||||
-rw-r--r-- | src/PyZyTest.cc | 2 | ||||
-rw-r--r-- | src/phrases.txt | 5 | ||||
-rw-r--r-- | src/special_table | 2 |
14 files changed, 35 insertions, 35 deletions
diff --git a/Makefile.am b/Makefile.am index 0584967..d23b4bf 100644 --- a/Makefile.am +++ b/Makefile.am @@ -118,7 +118,7 @@ dpkg: dist debian/changelog upload: dist ./tools/googlecode_upload.py \ -s "pyzy source code" \ - -p ibus \ + -p pyzy \ -l "Type-Source,OpSys-Linux,Chinese,Unstable" \ $(distdir).tar.gz diff --git a/configure.ac b/configure.ac index 92b503f..98043ed 100644 --- a/configure.ac +++ b/configure.ac @@ -36,7 +36,7 @@ m4_define([pyzy_api_version], [1.0]) AC_PREFEQ([2.62]) AC_INIT([pyzy], [pyzy_version], - [http://code.google.com/p/ibus/issues/entry], + [http://code.google.com/p/pyzy/issues/entry], [pyzy]) AC_CONFIG_HEADERS([config.h]) @@ -95,7 +95,7 @@ AM_PROG_LIBTOOL # check glib2 AM_PATH_GLIB_2_0 PKG_CHECK_MODULES(GLIB2, [ - glib-2.0 >= 2.26.0 + glib-2.0 >= 2.24.0 ]) # check sqlite @@ -134,7 +134,7 @@ AM_CONDITIONAL(HAVE_LIBUUID, test x"$HAVE_LIBUUID" = x"yes") AC_PATH_PROG(ENV, env) AC_SUBST(ENV) -# --disble-boost +# --enable-boost AC_ARG_ENABLE(boost, AC_HELP_STRING([--enable-boost], [Do not use boost and use stdc++0x to replace boost.]), @@ -163,14 +163,14 @@ if test x"$enable_opencc" = x"yes"; then ]) fi -# --enable-db-android +# --disable-db-android AC_ARG_ENABLE(db-android, AS_HELP_STRING([--disable-db-android], [do not build database from pinyin in android]), [enable_db_android=$enableval], [enable_db_android=yes] ) -AM_CONDITIONAL(IBUS_BUILD_DB_ANDROID, [test x"$enable_db_android" = x"yes" ]) +AM_CONDITIONAL(PYZY_BUILD_DB_ANDROID, [test x"$enable_db_android" = x"yes" ]) # --enable-db-open-phrase AC_ARG_ENABLE(db-open-phrase, @@ -179,7 +179,7 @@ AC_ARG_ENABLE(db-open-phrase, [enable_db_open_phrase=$enableval], [enable_db_open_phrase=no] ) -AM_CONDITIONAL(IBUS_BUILD_DB_OPEN_PHRASE, [test x"$enable_db_open_phrase" = x"yes" ]) +AM_CONDITIONAL(PYZY_BUILD_DB_OPEN_PHRASE, [test x"$enable_db_open_phrase" = x"yes" ]) # OUTPUT files AC_CONFIG_FILES([ diff --git a/data/db/android/Makefile.am b/data/db/android/Makefile.am index 0df6be7..f276ac5 100644 --- a/data/db/android/Makefile.am +++ b/data/db/android/Makefile.am @@ -30,7 +30,7 @@ data_files = \ rawdict_utf16_65105_freq.txt \ $(NULL) -if IBUS_BUILD_DB_ANDROID +if PYZY_BUILD_DB_ANDROID main_db_DATA = \ android.db \ $(NULL) diff --git a/data/db/open-phrase/Makefile.am b/data/db/open-phrase/Makefile.am index 481871e..94d8107 100644 --- a/data/db/open-phrase/Makefile.am +++ b/data/db/open-phrase/Makefile.am @@ -19,7 +19,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 # USA -if IBUS_BUILD_DB_OPEN_PHRASE +if PYZY_BUILD_DB_OPEN_PHRASE db_file = open-phrase.db main_db_DATA = \ db/$(db_file) \ @@ -31,7 +31,7 @@ DBTAR = pinyin-database-$(DBVER).tar.bz2 $(DBTAR): $(AM_V_GEN) \ - wget http://ibus.googlecode.com/files/$(DBTAR) || \ + wget http://pyzy.googlecode.com/files/$(DBTAR) || \ ( $(RM) $@; exit 1) stamp-db: $(DBTAR) diff --git a/pyzy-1.0.pc.in b/pyzy-1.0.pc.in index 94afe0f..3461035 100644 --- a/pyzy-1.0.pc.in +++ b/pyzy-1.0.pc.in @@ -3,7 +3,7 @@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ datadir=@datadir@ -pkgdatadir=@datadir@/ibus +pkgdatadir=@datadir@/pyzy Name: PyZy Description: Chinese PinYin & ZhuYin Library diff --git a/pyzy.spec.in b/pyzy.spec.in index acbff90..744287c 100644 --- a/pyzy.spec.in +++ b/pyzy.spec.in @@ -1,11 +1,11 @@ Name: @PACKAGE_NAME@ Version: @PACKAGE_VERSION@ Release: 1%{?dist} -Summary: The Chinese Pinyin and Bopomofo engines for IBus input platform -License: GPLv2+ +Summary: The Chinese PinYin and Bopomofo conversion library. +License: LGPL2.1 Group: System Environment/Libraries -URL: http://code.google.com/p/ibus -Source0: http://ibus.googlecode.com/files/%{name}-%{version}.tar.gz +URL: http://code.google.com/p/pyzy +Source0: http://pyzy.googlecode.com/files/%{name}-%{version}.tar.gz Source1: pinyin-database-1.2.99.tar.bz2 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) diff --git a/src/Makefile.am b/src/Makefile.am index 5c531b7..ff4bf5d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -126,8 +126,8 @@ libpyzy_1_0_la_LIBADD = \ @GLIB2_LIBS@ \ @SQLITE_LIBS@ \ @OPENCC_LIBS@ \ - -lgtest \ $(NULL) +# -lgtest if HAVE_LIBUUID libpyzy_1_0_la_CXXFLAGS += $(LIBUUID_CFLAGS) diff --git a/src/PyZyDatabase.cc b/src/PyZyDatabase.cc index 6216422..678fa6c 100644 --- a/src/PyZyDatabase.cc +++ b/src/PyZyDatabase.cc @@ -39,7 +39,7 @@ namespace PyZy { #define DB_PREFETCH_LEN (6) #define DB_BACKUP_TIMEOUT (60) -#define USER_DICTIONARY_FILE "user-1.3.db" +#define USER_DICTIONARY_FILE "user-1.0.db" std::unique_ptr<Database> Database::m_instance; @@ -718,15 +718,8 @@ Database::remove (const Phrase & phrase) void Database::init (const std::string & user_data_dir) { - String cache_dir = g_get_user_cache_dir (); - String absolute_data_dir = - cache_dir + - G_DIR_SEPARATOR_S + - user_data_dir; - absolute_data_dir.replace ("/", G_DIR_SEPARATOR_S); - if (m_instance.get () == NULL) { - m_instance.reset (new Database (absolute_data_dir)); + m_instance.reset (new Database (user_data_dir)); } } diff --git a/src/PyZyInputContext.cc b/src/PyZyInputContext.cc index fc78597..3fb383d 100644 --- a/src/PyZyInputContext.cc +++ b/src/PyZyInputContext.cc @@ -21,17 +21,22 @@ */ #include "PyZyPhoneticContext.h" -#include "PyZyFullPinyinContext.h" -#include "PyZyDoublePinyinContext.h" +#include <glib.h> +#include <string> + #include "PyZyBopomofoContext.h" #include "PyZyDatabase.h" +#include "PyZyDoublePinyinContext.h" +#include "PyZyFullPinyinContext.h" namespace PyZy { void InputContext::init () { - init ("libpyzy"); + const std::string cache_dir = g_get_user_cache_dir (); + const std::string data_dir = cache_dir + G_DIR_SEPARATOR_S + "pyzy"; + init (data_dir); } void diff --git a/src/PyZySpecialPhraseTable.cc b/src/PyZySpecialPhraseTable.cc index f9f155a..d1c23c0 100644 --- a/src/PyZySpecialPhraseTable.cc +++ b/src/PyZySpecialPhraseTable.cc @@ -43,7 +43,7 @@ private: SpecialPhraseTable::SpecialPhraseTable (void) { char * path = g_build_filename (g_get_user_config_dir (), - "ibus", "pinyin", "phrases.txt", NULL); + "pyzy", "phrases.txt", NULL); load ("phrases.txt") || load (path) || diff --git a/src/PyZyString.h b/src/PyZyString.h index f0b2328..5209dc9 100644 --- a/src/PyZyString.h +++ b/src/PyZyString.h @@ -120,6 +120,11 @@ public: return appendPrintf ("%u", i); } + String & operator<< (unsigned long i) + { + return appendPrintf ("%lu", i); + } + String & operator<< (const char ch) { append (1, ch); diff --git a/src/PyZyTest.cc b/src/PyZyTest.cc index 11e3084..120ec9f 100644 --- a/src/PyZyTest.cc +++ b/src/PyZyTest.cc @@ -55,7 +55,7 @@ protected: db_file += G_DIR_SEPARATOR_S; db_file += "libpyzy-test"; db_file += G_DIR_SEPARATOR_S; - db_file += "user-1.3.db"; + db_file += "user-1.0.db"; g_unlink (db_file.c_str ()); } }; diff --git a/src/phrases.txt b/src/phrases.txt index bdc209c..452c09f 100644 --- a/src/phrases.txt +++ b/src/phrases.txt @@ -1,9 +1,6 @@ -; ibus 拼音输入法--自定义短语配置文件 +; The Chinese PinYin and Bopomofo conversion library. ; ; 说明: -; **注意** -; 修改后请重新启动输入法 -; 或者运行下面命令:pkill -x -u $USERNAME ibus-engine-pinyin ; 格式: ; 英文字符串=短语 ; 英文字符串=#动态短语 diff --git a/src/special_table b/src/special_table index 6ef631a..eddb8d5 100644 --- a/src/special_table +++ b/src/special_table @@ -8,7 +8,7 @@ # # 以 X_ 开头的特殊字符串为内建标识 例如 X_DATE_1 代表阿拉伯数字格式的当前日期. # -# 用户可以按照该文件格式自行编辑定制的用户文件 ~/.ibus/pinyin/special_table +# 用户可以按照该文件格式自行编辑定制的用户文件 ~/.pyzy/special_table # # 当前日期 |