Skip to content
This repository
  • 3 commits
  • 5 files changed
  • 0 comments
  • 1 contributor
2  configure.ac
@@ -5,7 +5,7 @@
5 5
 m4_define([libpinyin_major_version], [0])
6 6
 m4_define([libpinyin_minor_version], [9])
7 7
 m4_define([libpinyin_micro_version], [91])
8  
-m4_define([libpinyin_abi_current], [3])
  8
+m4_define([libpinyin_abi_current], [4])
9 9
 m4_define([libpinyin_abi_revision], [0])
10 10
 
11 11
 m4_define([libpinyin_version],
29  src/pinyin.cpp
@@ -51,11 +51,40 @@ struct _pinyin_context_t{
51 51
     bool m_modified;
52 52
 };
53 53
 
  54
+struct _pinyin_instance_t{
  55
+    pinyin_context_t * m_context;
  56
+    gchar * m_raw_full_pinyin;
  57
+    TokenVector m_prefixes;
  58
+    ChewingKeyVector m_pinyin_keys;
  59
+    ChewingKeyRestVector m_pinyin_key_rests;
  60
+    CandidateConstraints m_constraints;
  61
+    MatchResults m_match_results;
  62
+    CandidateVector m_candidates;
  63
+};
  64
+
  65
+struct _lookup_candidate_t{
  66
+    enum lookup_candidate_type_t m_candidate_type;
  67
+    gchar * m_phrase_string;
  68
+    phrase_token_t m_token;
  69
+    ChewingKeyRest m_orig_rest;
  70
+    gchar * m_new_pinyins;
  71
+    guint32 m_freq; /* the amplifed gfloat numerical value. */
  72
+public:
  73
+    _lookup_candidate_t() {
  74
+        m_candidate_type = NORMAL_CANDIDATE;
  75
+        m_phrase_string = NULL;
  76
+        m_token = null_token;
  77
+        m_new_pinyins = NULL;
  78
+        m_freq = 0;
  79
+    }
  80
+};
  81
+
54 82
 struct _import_iterator_t{
55 83
     pinyin_context_t * m_context;
56 84
     guint8 m_phrase_index;
57 85
 };
58 86
 
  87
+
59 88
 static bool check_format(const char * userdir){
60 89
     gchar * filename = g_build_filename
61 90
         (userdir, "version", NULL);
27  src/pinyin.h
@@ -63,33 +63,6 @@ enum lookup_candidate_type_t{
63 63
     ZOMBIE_CANDIDATE
64 64
 };
65 65
 
66  
-struct _lookup_candidate_t{
67  
-    enum lookup_candidate_type_t m_candidate_type;
68  
-    gchar * m_phrase_string;
69  
-    phrase_token_t m_token;
70  
-    ChewingKeyRest m_orig_rest;
71  
-    gchar * m_new_pinyins;
72  
-    guint32 m_freq; /* the amplifed gfloat numerical value. */
73  
-public:
74  
-    _lookup_candidate_t() {
75  
-        m_candidate_type = NORMAL_CANDIDATE;
76  
-        m_phrase_string = NULL;
77  
-        m_token = null_token;
78  
-        m_new_pinyins = NULL;
79  
-        m_freq = 0;
80  
-    }
81  
-};
82  
-
83  
-struct _pinyin_instance_t{
84  
-    pinyin_context_t * m_context;
85  
-    gchar * m_raw_full_pinyin;
86  
-    TokenVector m_prefixes;
87  
-    ChewingKeyVector m_pinyin_keys;
88  
-    ChewingKeyRestVector m_pinyin_key_rests;
89  
-    CandidateConstraints m_constraints;
90  
-    MatchResults m_match_results;
91  
-};
92  
-
93 66
 /**
94 67
  * pinyin_init:
95 68
  * @systemdir: the system wide language model data directory.
14  src/storage/chewing_key.h
@@ -37,21 +37,21 @@ namespace pinyin{
37 37
  *    As the chewing large table only contains information of struct ChewingKey.
38 38
  */
39 39
 
40  
-struct ChewingKey
  40
+struct _ChewingKey
41 41
 {
42 42
     guint16 m_initial : 5;
43 43
     guint16 m_middle  : 2;
44 44
     guint16 m_final   : 5;
45 45
     guint16 m_tone    : 3;
46 46
 
47  
-    ChewingKey() {
  47
+    _ChewingKey() {
48 48
         m_initial = CHEWING_ZERO_INITIAL;
49 49
         m_middle  = CHEWING_ZERO_MIDDLE;
50 50
         m_final   = CHEWING_ZERO_FINAL;
51 51
         m_tone    = CHEWING_ZERO_TONE;
52 52
     }
53 53
 
54  
-    ChewingKey(ChewingInitial initial, ChewingMiddle middle,
  54
+    _ChewingKey(ChewingInitial initial, ChewingMiddle middle,
55 55
                ChewingFinal final) {
56 56
         m_initial = initial;
57 57
         m_middle = middle;
@@ -69,6 +69,8 @@ struct ChewingKey
69 69
     gchar * get_chewing_string();
70 70
 };
71 71
 
  72
+typedef struct _ChewingKey ChewingKey;
  73
+
72 74
 static inline bool operator == (ChewingKey lhs, ChewingKey rhs) {
73 75
     if (lhs.m_initial != rhs.m_initial)
74 76
         return false;
@@ -81,7 +83,7 @@ static inline bool operator == (ChewingKey lhs, ChewingKey rhs) {
81 83
     return true;
82 84
 }
83 85
 
84  
-struct ChewingKeyRest
  86
+struct _ChewingKeyRest
85 87
 {
86 88
     /* Note: the table index is removed,
87 89
      *   Please use get_table_index in ChewingKey.
@@ -89,7 +91,7 @@ struct ChewingKeyRest
89 91
     guint16 m_raw_begin;           /* the begin of the raw input. */
90 92
     guint16 m_raw_end;             /* the end of the raw input. */
91 93
 
92  
-    ChewingKeyRest() {
  94
+    _ChewingKeyRest() {
93 95
         /* the 0th item in pinyin parser table is reserved for invalid. */
94 96
         m_raw_begin = 0;
95 97
         m_raw_end = 0;
@@ -100,6 +102,8 @@ struct ChewingKeyRest
100 102
     }
101 103
 };
102 104
 
  105
+typedef struct _ChewingKeyRest ChewingKeyRest;
  106
+
103 107
 };
104 108
 
105 109
 #endif
10  src/storage/pinyin_parser2.cpp
@@ -72,7 +72,7 @@ static bool check_chewing_options(pinyin_option_t options, const chewing_index_i
72 72
 }
73 73
 
74 74
 
75  
-gint ChewingKey::get_table_index() {
  75
+gint _ChewingKey::get_table_index() {
76 76
     assert(m_initial <  CHEWING_NUMBER_OF_INITIALS);
77 77
     assert(m_middle < CHEWING_NUMBER_OF_MIDDLES);
78 78
     assert(m_final < CHEWING_NUMBER_OF_FINALS);
@@ -81,7 +81,7 @@ gint ChewingKey::get_table_index() {
81 81
     return index == -1 ? 0 : index;
82 82
 }
83 83
 
84  
-gchar * ChewingKey::get_pinyin_string() {
  84
+gchar * _ChewingKey::get_pinyin_string() {
85 85
     assert(m_tone < CHEWING_NUMBER_OF_TONES);
86 86
     gint index = get_table_index();
87 87
     assert(index < G_N_ELEMENTS(content_table));
@@ -94,21 +94,21 @@ gchar * ChewingKey::get_pinyin_string() {
94 94
     }
95 95
 }
96 96
 
97  
-gchar * ChewingKey::get_shengmu_string() {
  97
+gchar * _ChewingKey::get_shengmu_string() {
98 98
     gint index = get_table_index();
99 99
     assert(index < G_N_ELEMENTS(content_table));
100 100
     const content_table_item_t & item = content_table[index];
101 101
     return g_strdup(item.m_shengmu_str);
102 102
 }
103 103
 
104  
-gchar * ChewingKey::get_yunmu_string() {
  104
+gchar * _ChewingKey::get_yunmu_string() {
105 105
     gint index = get_table_index();
106 106
     assert(index < G_N_ELEMENTS(content_table));
107 107
     const content_table_item_t & item = content_table[index];
108 108
     return g_strdup(item.m_yunmu_str);
109 109
 }
110 110
 
111  
-gchar * ChewingKey::get_chewing_string() {
  111
+gchar * _ChewingKey::get_chewing_string() {
112 112
     assert(m_tone < CHEWING_NUMBER_OF_TONES);
113 113
     gint index = get_table_index();
114 114
     assert(index < G_N_ELEMENTS(content_table));

No commit comments for this range

Something went wrong with that request. Please try again.