summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiroshi Sumita <hsumita@chromium.org>2012-05-08 10:59:55 +0900
committerHiroshi Sumita <hsumita@chromium.org>2012-05-08 10:59:55 +0900
commitf9e9a4fd3bfaceb9696703bfa5e41dbafe7c983d (patch)
tree508a9a342d45f2ca120d3af2783bcae2be87019a
parent568f8d28c65aa44ed2131b0a091982429cd5941e (diff)
downloadpyzy-f9e9a4fd3bfaceb9696703bfa5e41dbafe7c983d.tar.gz
Move some constants from PyZyTypes to PyZyConfig
BUG=None TEST=Manually Review URL: https://codereview.appspot.com/6201053
-rw-r--r--configure.ac2
-rw-r--r--src/PyZyConfig.cc1
-rw-r--r--src/PyZyConfig.h61
-rw-r--r--src/PyZyDatabase.cc1
-rw-r--r--src/PyZyDoublePinyinTable.h8
-rw-r--r--src/PyZyPhoneticContext.h2
-rw-r--r--src/PyZyPinyinParser.cc1
-rw-r--r--src/PyZySimpTradConverter.cc1
-rw-r--r--src/PyZyTypes.h39
9 files changed, 58 insertions, 58 deletions
diff --git a/configure.ac b/configure.ac
index 081f7b3..9026255 100644
--- a/configure.ac
+++ b/configure.ac
@@ -24,7 +24,7 @@ m4_define([pyzy_released], [1])
m4_define([pyzy_major_version], [0])
m4_define([pyzy_minor_version], [0])
-m4_define([pyzy_micro_version], [2])
+m4_define([pyzy_micro_version], [3])
m4_define([pyzy_interface_age], [0])
m4_define([pyzy_binary_age],
[m4_eval(100 * pyzy_minor_version + pyzy_micro_version)])
diff --git a/src/PyZyConfig.cc b/src/PyZyConfig.cc
index 5961dda..d0180bb 100644
--- a/src/PyZyConfig.cc
+++ b/src/PyZyConfig.cc
@@ -22,7 +22,6 @@
#include "PyZyConfig.h"
#include "PyZyUtil.h"
-#include "PyZyTypes.h"
#include "PyZyDoublePinyinTable.h"
namespace PyZy {
diff --git a/src/PyZyConfig.h b/src/PyZyConfig.h
index 02505b3..0b43a88 100644
--- a/src/PyZyConfig.h
+++ b/src/PyZyConfig.h
@@ -22,15 +22,60 @@
#ifndef __PYZY_CONFIG_H_
#define __PYZY_CONFIG_H_
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <string>
-
namespace PyZy {
-#define MAX_PINYIN_LEN 64
+#define PINYIN_INCOMPLETE_PINYIN (1U << 0)
+
+#define PINYIN_CORRECT_GN_TO_NG (1U << 1)
+#define PINYIN_CORRECT_MG_TO_NG (1U << 2)
+#define PINYIN_CORRECT_IOU_TO_IU (1U << 3)
+#define PINYIN_CORRECT_UEI_TO_UI (1U << 4)
+#define PINYIN_CORRECT_UEN_TO_UN (1U << 5)
+#define PINYIN_CORRECT_UE_TO_VE (1U << 6)
+#define PINYIN_CORRECT_V_TO_U (1U << 7)
+#define PINYIN_CORRECT_ON_TO_ONG (1U << 8)
+#define PINYIN_CORRECT_ALL (0x000001fe)
+
+#define PINYIN_FUZZY_C_CH (1U << 9)
+#define PINYIN_FUZZY_CH_C (1U << 10)
+#define PINYIN_FUZZY_Z_ZH (1U << 11)
+#define PINYIN_FUZZY_ZH_Z (1U << 12)
+#define PINYIN_FUZZY_S_SH (1U << 13)
+#define PINYIN_FUZZY_SH_S (1U << 14)
+#define PINYIN_FUZZY_L_N (1U << 15)
+#define PINYIN_FUZZY_N_L (1U << 16)
+#define PINYIN_FUZZY_F_H (1U << 17)
+#define PINYIN_FUZZY_H_F (1U << 18)
+#define PINYIN_FUZZY_L_R (1U << 19)
+#define PINYIN_FUZZY_R_L (1U << 20)
+#define PINYIN_FUZZY_K_G (1U << 21)
+#define PINYIN_FUZZY_G_K (1U << 22)
+
+#define PINYIN_FUZZY_AN_ANG (1U << 23)
+#define PINYIN_FUZZY_ANG_AN (1U << 24)
+#define PINYIN_FUZZY_EN_ENG (1U << 25)
+#define PINYIN_FUZZY_ENG_EN (1U << 26)
+#define PINYIN_FUZZY_IN_ING (1U << 27)
+#define PINYIN_FUZZY_ING_IN (1U << 28)
+#define PINYIN_FUZZY_IAN_IANG PINYIN_FUZZY_AN_ANG
+#define PINYIN_FUZZY_IANG_IAN PINYIN_FUZZY_ANG_AN
+#define PINYIN_FUZZY_UAN_UANG PINYIN_FUZZY_AN_ANG
+#define PINYIN_FUZZY_UANG_UAN PINYIN_FUZZY_ANG_AN
+#define PINYIN_FUZZY_ALL (0x1ffffe00)
+
+#define DOUBLE_PINYIN_KEYBOARD_MSPY (0)
+#define DOUBLE_PINYIN_KEYBOARD_ZRM (1)
+#define DOUBLE_PINYIN_KEYBOARD_ABC (2)
+#define DOUBLE_PINYIN_KEYBOARD_ZGPY (3)
+#define DOUBLE_PINYIN_KEYBOARD_PYJJ (4)
+#define DOUBLE_PINYIN_KEYBOARD_XHE (5)
+#define DOUBLE_PINYIN_KEYBOARD_LAST (5)
+
+#define BOPOMOFO_KEYBOARD_STANDARD (0)
+#define BOPOMOFO_KEYBOARD_CHING_YEAH (1)
+#define BOPOMOFO_KEYBOARD_ETAN (2)
+#define BOPOMOFO_KEYBOARD_IBM (3)
+#define BOPOMOFO_KEYBOARD_LAST (3)
class Config {
protected:
@@ -74,7 +119,7 @@ private:
PinyinConfigImpl *m_pinyin_impl;
};
-/* Bopomof Config */
+/* Bopomofo Config */
class BopomofoConfig : public Config {
public:
static BopomofoConfig & instance (void);
diff --git a/src/PyZyDatabase.cc b/src/PyZyDatabase.cc
index 678fa6c..064f54a 100644
--- a/src/PyZyDatabase.cc
+++ b/src/PyZyDatabase.cc
@@ -23,6 +23,7 @@
#include <glib.h>
#include <glib/gstdio.h>
#include <sqlite3.h>
+#include "PyZyConfig.h"
#include "PyZyUtil.h"
#include "PyZyPinyinArray.h"
diff --git a/src/PyZyDoublePinyinTable.h b/src/PyZyDoublePinyinTable.h
index 16bf908..68081ba 100644
--- a/src/PyZyDoublePinyinTable.h
+++ b/src/PyZyDoublePinyinTable.h
@@ -22,14 +22,6 @@
#ifndef __PYZY_DOUBLE_PINYIN_TABLE_H_
#define __PYZY_DOUBLE_PINYIN_TABLE_H_
-#define DOUBLE_PINYIN_MSPY (0)
-#define DOUBLE_PINYIN_ZRM (1)
-#define DOUBLE_PINYIN_ABC (2)
-#define DOUBLE_PINYIN_ZGPY (3)
-#define DOUBLE_PINYIN_PYJJ (4)
-#define DOUBLE_PINYIN_XHE (5)
-#define DOUBLE_PINYIN_LAST (5)
-
#ifdef DEFINE_DOUBLE_PINYIN_TABLES
#define PINYIN_ID_AEO PINYIN_ID_ZERO
diff --git a/src/PyZyPhoneticContext.h b/src/PyZyPhoneticContext.h
index 70593a2..957e52c 100644
--- a/src/PyZyPhoneticContext.h
+++ b/src/PyZyPhoneticContext.h
@@ -32,6 +32,8 @@
namespace PyZy {
+#define MAX_PINYIN_LEN 64
+
struct Preedit {
std::string selected_text;
std::string candidate_text;
diff --git a/src/PyZyPinyinParser.cc b/src/PyZyPinyinParser.cc
index f9000a9..051e73a 100644
--- a/src/PyZyPinyinParser.cc
+++ b/src/PyZyPinyinParser.cc
@@ -22,6 +22,7 @@
#include <cstring>
#include <cstdlib>
+#include "PyZyConfig.h"
#include "PyZyPinyinParser.h"
namespace PyZy {
diff --git a/src/PyZySimpTradConverter.cc b/src/PyZySimpTradConverter.cc
index 35bbec8..153b138 100644
--- a/src/PyZySimpTradConverter.cc
+++ b/src/PyZySimpTradConverter.cc
@@ -33,7 +33,6 @@
# include <cstdlib>
#endif
-#include "PyZyTypes.h"
#include "PyZyString.h"
namespace PyZy {
diff --git a/src/PyZyTypes.h b/src/PyZyTypes.h
index b92da14..559fc9d 100644
--- a/src/PyZyTypes.h
+++ b/src/PyZyTypes.h
@@ -85,45 +85,6 @@ namespace PyZy {
#define PINYIN_ID_V (56)
#define PINYIN_ID_NG PINYIN_ID_VOID
-#define PINYIN_INCOMPLETE_PINYIN (1U << 0)
-
-#define PINYIN_CORRECT_GN_TO_NG (1U << 1)
-#define PINYIN_CORRECT_MG_TO_NG (1U << 2)
-#define PINYIN_CORRECT_IOU_TO_IU (1U << 3)
-#define PINYIN_CORRECT_UEI_TO_UI (1U << 4)
-#define PINYIN_CORRECT_UEN_TO_UN (1U << 5)
-#define PINYIN_CORRECT_UE_TO_VE (1U << 6)
-#define PINYIN_CORRECT_V_TO_U (1U << 7)
-#define PINYIN_CORRECT_ON_TO_ONG (1U << 8)
-#define PINYIN_CORRECT_ALL (0x000001fe)
-
-#define PINYIN_FUZZY_C_CH (1U << 9)
-#define PINYIN_FUZZY_CH_C (1U << 10)
-#define PINYIN_FUZZY_Z_ZH (1U << 11)
-#define PINYIN_FUZZY_ZH_Z (1U << 12)
-#define PINYIN_FUZZY_S_SH (1U << 13)
-#define PINYIN_FUZZY_SH_S (1U << 14)
-#define PINYIN_FUZZY_L_N (1U << 15)
-#define PINYIN_FUZZY_N_L (1U << 16)
-#define PINYIN_FUZZY_F_H (1U << 17)
-#define PINYIN_FUZZY_H_F (1U << 18)
-#define PINYIN_FUZZY_L_R (1U << 19)
-#define PINYIN_FUZZY_R_L (1U << 20)
-#define PINYIN_FUZZY_K_G (1U << 21)
-#define PINYIN_FUZZY_G_K (1U << 22)
-
-#define PINYIN_FUZZY_AN_ANG (1U << 23)
-#define PINYIN_FUZZY_ANG_AN (1U << 24)
-#define PINYIN_FUZZY_EN_ENG (1U << 25)
-#define PINYIN_FUZZY_ENG_EN (1U << 26)
-#define PINYIN_FUZZY_IN_ING (1U << 27)
-#define PINYIN_FUZZY_ING_IN (1U << 28)
-#define PINYIN_FUZZY_IAN_IANG PINYIN_FUZZY_AN_ANG
-#define PINYIN_FUZZY_IANG_IAN PINYIN_FUZZY_ANG_AN
-#define PINYIN_FUZZY_UAN_UANG PINYIN_FUZZY_AN_ANG
-#define PINYIN_FUZZY_UANG_UAN PINYIN_FUZZY_ANG_AN
-#define PINYIN_FUZZY_ALL (0x1ffffe00)
-
struct Pinyin {
const char *text;
const wchar_t *bopomofo;