1 /*
2  * Copyright (C) 2008-2009 SVOX AG, Baslerstr. 30, 8048 Zuerich, Switzerland
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 /**
17  * @file picoknow.h
18  *
19  * Copyright (C) 2008-2009 SVOX AG, Baslerstr. 30, 8048 Zuerich, Switzerland
20  * All rights reserved.
21  *
22  * History:
23  * - 2009-04-20 -- initial version
24  *
25  */
26 /**
27  * @addtogroup picoknow
28 
29  * <b> Pico knowledge base </b>\n
30  *
31 */
32 
33 #ifndef PICOKNOW_H_
34 #define PICOKNOW_H_
35 
36 #include "picodefs.h"
37 #include "picoos.h"
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 #if 0
43 }
44 #endif
45 
46 
47 typedef enum picoknow_kb_id {
48     PICOKNOW_KBID_NULL         = 0,
49     /* base / tpp 1 - 7 */
50     PICOKNOW_KBID_TPP_MAIN     = 1,
51     PICOKNOW_KBID_TAB_GRAPHS   = 2,
52     PICOKNOW_KBID_TAB_PHONES   = 3,
53     PICOKNOW_KBID_TAB_POS      = 4,
54     PICOKNOW_KBID_FIXED_IDS    = 7,
55     /* debug */
56     PICOKNOW_KBID_DBG          = 8,
57 
58     /* textana 9 - 32 */
59     PICOKNOW_KBID_LEX_MAIN     = 9,
60     PICOKNOW_KBID_DT_POSP      = 10,
61     PICOKNOW_KBID_DT_POSD      = 11,
62     PICOKNOW_KBID_DT_G2P       = 12,
63     PICOKNOW_KBID_FST_WPHO_1   = 13,
64     PICOKNOW_KBID_FST_WPHO_2   = 14,
65     PICOKNOW_KBID_FST_WPHO_3   = 15,
66     PICOKNOW_KBID_FST_WPHO_4   = 16,
67     PICOKNOW_KBID_FST_WPHO_5   = 17,
68     PICOKNOW_KBID_DT_PHR       = 18,
69     PICOKNOW_KBID_DT_ACC       = 19,
70     PICOKNOW_KBID_FST_SPHO_1   = 20,
71     PICOKNOW_KBID_FST_SPHO_2   = 21,
72     PICOKNOW_KBID_FST_SPHO_3   = 22,
73     PICOKNOW_KBID_FST_SPHO_4   = 23,
74     PICOKNOW_KBID_FST_SPHO_5   = 24,
75 
76     PICOKNOW_KBID_FST_XSAMPA_PARSE   = 25,
77     PICOKNOW_KBID_FST_SVOXPA_PARSE   = 26,
78     PICOKNOW_KBID_FST_XSAMPA2SVOXPA   = 27,
79 
80     PICOKNOW_KBID_FST_SPHO_6   = 28,
81     PICOKNOW_KBID_FST_SPHO_7   = 29,
82     PICOKNOW_KBID_FST_SPHO_8   = 30,
83     PICOKNOW_KBID_FST_SPHO_9   = 31,
84     PICOKNOW_KBID_FST_SPHO_10   = 32,
85 
86 
87     /* siggen 33 - 48 */
88     PICOKNOW_KBID_DT_DUR       = 34,
89     PICOKNOW_KBID_DT_LFZ1      = 35,
90     PICOKNOW_KBID_DT_LFZ2      = 36,
91     PICOKNOW_KBID_DT_LFZ3      = 37,
92     PICOKNOW_KBID_DT_LFZ4      = 38,
93     PICOKNOW_KBID_DT_LFZ5      = 39,
94     PICOKNOW_KBID_DT_MGC1      = 40,
95     PICOKNOW_KBID_DT_MGC2      = 41,
96     PICOKNOW_KBID_DT_MGC3      = 42,
97     PICOKNOW_KBID_DT_MGC4      = 43,
98     PICOKNOW_KBID_DT_MGC5      = 44,
99     PICOKNOW_KBID_PDF_DUR      = 45,
100     PICOKNOW_KBID_PDF_LFZ      = 46,
101     PICOKNOW_KBID_PDF_MGC      = 47,
102     PICOKNOW_KBID_PDF_PHS      = 48,
103 
104     /* user tpp 49 - 56 */
105     PICOKNOW_KBID_TPP_USER_1    = 49,
106     PICOKNOW_KBID_TPP_USER_2    = 50,
107 
108     /* user lex 57 - 63 */
109     PICOKNOW_KBID_LEX_USER_1    = 57,
110     PICOKNOW_KBID_LEX_USER_2    = 58,
111 
112     PICOKNOW_KBID_DUMMY        = 127
113 
114 } picoknow_kb_id_t;
115 
116 #define PICOKNOW_DEFAULT_RESOURCE_NAME (picoos_char *) "__PICO_DEF_RSRC"
117 
118 #define PICOKNOW_MAX_NUM_WPHO_FSTS 5
119 #define PICOKNOW_MAX_NUM_SPHO_FSTS 10
120 #define PICOKNOW_MAX_NUM_ULEX 2
121 #define PICOKNOW_MAX_NUM_UTPP 2
122 
123 #define PICOKNOW_KBID_WPHO_ARRAY { \
124   PICOKNOW_KBID_FST_WPHO_1, \
125   PICOKNOW_KBID_FST_WPHO_2, \
126   PICOKNOW_KBID_FST_WPHO_3, \
127   PICOKNOW_KBID_FST_WPHO_4, \
128   PICOKNOW_KBID_FST_WPHO_5  \
129 }
130 
131 #define PICOKNOW_KBID_SPHO_ARRAY { \
132   PICOKNOW_KBID_FST_SPHO_1, \
133   PICOKNOW_KBID_FST_SPHO_2, \
134   PICOKNOW_KBID_FST_SPHO_3, \
135   PICOKNOW_KBID_FST_SPHO_4, \
136   PICOKNOW_KBID_FST_SPHO_5,  \
137   PICOKNOW_KBID_FST_SPHO_6,  \
138   PICOKNOW_KBID_FST_SPHO_7,  \
139   PICOKNOW_KBID_FST_SPHO_8,  \
140   PICOKNOW_KBID_FST_SPHO_9,  \
141   PICOKNOW_KBID_FST_SPHO_10  \
142 }
143 
144 #define PICOKNOW_KBID_ULEX_ARRAY { \
145     PICOKNOW_KBID_LEX_USER_1, \
146     PICOKNOW_KBID_LEX_USER_2, \
147 }
148 
149 #define PICOKNOW_KBID_UTPP_ARRAY { \
150     PICOKNOW_KBID_TPP_USER_1, \
151     PICOKNOW_KBID_TPP_USER_2, \
152 }
153 
154 /* max size (including NULLC) of descriptive name corresponding to KBID */
155 #define PICOKNOW_MAX_KB_NAME_SIZ 16
156 
157 /* maximum number of kbs in one resource */
158 #define PICOKNOW_MAX_NUM_RESOURCE_KBS 64
159 
160 
161 /**  class   : KnowledgeBase
162  *   shortcut : kb
163  *
164  */
165 typedef struct picoknow_knowledge_base * picoknow_KnowledgeBase;
166 
167 typedef pico_status_t (* picoknow_kbSubDeallocate) (register picoknow_KnowledgeBase this, picoos_MemoryManager mm);
168 
169 typedef struct picoknow_knowledge_base {
170     /* public */
171     picoknow_KnowledgeBase next;
172     picoknow_kb_id_t id;
173     picoos_uint8 * base; /* start address */
174     picoos_uint32 size; /* size */
175 
176     /* protected */
177     picoknow_kbSubDeallocate subDeallocate;
178     void * subObj;
179 } picoknow_knowledge_base_t;
180 
181 extern picoknow_KnowledgeBase picoknow_newKnowledgeBase(picoos_MemoryManager mm);
182 
183 extern void picoknow_disposeKnowledgeBase(picoos_MemoryManager mm, picoknow_KnowledgeBase * this);
184 
185 #ifdef __cplusplus
186 }
187 #endif
188 
189 
190 #endif /*PICOKNOW_H_*/
191