summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2015-05-20 17:10:43 +0800
committerPeng Wu <alexepico@gmail.com>2015-05-20 17:10:43 +0800
commitfad72be7fbcc4f52bfc1ce28c2caaa32ac5f9188 (patch)
tree5f658287a607ccafefadab577148f928049507e3
parent2f6ca082caa7be4e32d61fff80f9330ef800086f (diff)
downloadlibpinyin-fad72be7fbcc4f52bfc1ce28c2caaa32ac5f9188.tar.gz
libpinyin-fad72be7fbcc4f52bfc1ce28c2caaa32ac5f9188.tar.xz
libpinyin-fad72be7fbcc4f52bfc1ce28c2caaa32ac5f9188.zip
update table info
-rw-r--r--src/include/novel_types.h13
-rw-r--r--src/storage/table_info.cpp24
2 files changed, 4 insertions, 33 deletions
diff --git a/src/include/novel_types.h b/src/include/novel_types.h
index 4ccb185..7c545be 100644
--- a/src/include/novel_types.h
+++ b/src/include/novel_types.h
@@ -151,19 +151,6 @@ typedef enum {
ADDON_DICTIONARY = 4,
NETWORK_DICTIONARY = 5,
USER_DICTIONARY = 6,
-
- /* for addon tables. */
- ART_DICTIONARY = 4,
- CULTURE_DICTIONARY = 5,
- ECONOMY_DICTIONARY = 6,
- GEOLOGY_DICTIONARY = 7,
- HISTORY_DICTIONARY = 8,
-
- LIFE_DICTIONARY = 9,
- NATURE_DICTIONARY = 10,
- SCITECH_DICTIONARY = 11,
- SOCIETY_DICTIONARY = 12,
- SPORT_DICTIONARY = 13,
} PHRASE_INDEX_LIBRARIES;
G_END_DECLS
diff --git a/src/storage/table_info.cpp b/src/storage/table_info.cpp
index 3cc0804..0e58680 100644
--- a/src/storage/table_info.cpp
+++ b/src/storage/table_info.cpp
@@ -118,22 +118,6 @@ static guint8 to_index_of_default_tables(const char * str) {
assert(FALSE);
}
-static guint8 to_index_of_addon_tables(const char * str) {
- HANDLE(ART_DICTIONARY);
- HANDLE(CULTURE_DICTIONARY);
- HANDLE(ECONOMY_DICTIONARY);
- HANDLE(GEOLOGY_DICTIONARY);
- HANDLE(HISTORY_DICTIONARY);
-
- HANDLE(LIFE_DICTIONARY);
- HANDLE(NATURE_DICTIONARY);
- HANDLE(SCITECH_DICTIONARY);
- HANDLE(SOCIETY_DICTIONARY);
- HANDLE(SPORT_DICTIONARY);
-
- assert(FALSE);
-}
-
static gchar * to_string(const char * str) {
if (0 == strcmp(str, "NULL"))
return NULL;
@@ -210,11 +194,11 @@ bool SystemTableInfo2::load(const char * filename) {
m_table_phonetic_type = type;
int index = 0;
- char tableinfo[256], dictname[256];
+ char tableinfo[256], dictstr[256];
char tablefile[256], sysfile[256], userfile[256], filetype[256];
while (!feof(input)) {
num = fscanf(input, "%256s %256s %256s %256s %256s %256s\n",
- tableinfo, dictname, tablefile,
+ tableinfo, dictstr, tablefile,
sysfile, userfile, filetype);
if (6 != num)
@@ -224,10 +208,10 @@ bool SystemTableInfo2::load(const char * filename) {
pinyin_table_info_t * tables = NULL;
if (0 == strcmp("default", tableinfo)) {
tables = m_default_tables;
- index = to_index_of_default_tables(dictname);
+ index = to_index_of_default_tables(dictstr);
} else if (0 == strcmp("addon", tableinfo)) {
tables = m_addon_tables;
- index = to_index_of_addon_tables(dictname);
+ index = atoi(dictstr);
} else
assert(FALSE);