1/*---------------------------------------------------------------------------*
2 *  SWIslts.h  *
3 *                                                                           *
4 *  Copyright 2007, 2008 Nuance Communciations, Inc.                               *
5 *                                                                           *
6 *  Licensed under the Apache License, Version 2.0 (the 'License');          *
7 *  you may not use this file except in compliance with the License.         *
8 *                                                                           *
9 *  You may obtain a copy of the License at                                  *
10 *      http://www.apache.org/licenses/LICENSE-2.0                           *
11 *                                                                           *
12 *  Unless required by applicable law or agreed to in writing, software      *
13 *  distributed under the License is distributed on an 'AS IS' BASIS,        *
14 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
15 *  See the License for the specific language governing permissions and      *
16 *  limitations under the License.                                           *
17 *                                                                           *
18 *---------------------------------------------------------------------------*/
19
20
21
22#ifndef _SWI_SLTS_H__
23#define _SWI_SLTS_H__
24
25#ifdef SWISLTS_USE_STATIC_API
26  #define SWISLTS_FNDECLARE
27#else
28  #ifdef WIN32
29    #ifdef _IN_SWI_SLTS__
30      #define SWISLTS_FNDECLARE __declspec(dllexport)
31    #else
32      #define SWISLTS_FNDECLARE __declspec(dllimport)
33    #endif
34  #else
35    #define SWISLTS_FNDECLARE
36  #endif
37#endif
38
39typedef void * SWIsltsHand;
40
41typedef enum {
42  SWIsltsSuccess = 1,
43  SWIsltsErrAllocResource = 2,
44  SWIsltsInvalidParam = 3,
45  SWIsltsMaxInputExceeded = 4,
46  SWIsltsEmptyPhoneString = 5,
47  SWIsltsInternalErr = 6,
48  SSWIsltsUnknownInputChar = 7,
49  SWIsltsFileOpenErr = 8,
50  SWIsltsFileReadErr = 9,
51  SWIsltsFileWriteErr = 10
52}SWIsltsResult;
53
54typedef struct SWIsltsTranscription {
55  void  * pBuffer;
56  size_t  nSizeOfBuffer;
57} SWIsltsTranscription;
58
59typedef struct SWIsltsWrapper {
60  SWIsltsResult (*init) (void);
61  SWIsltsResult (*term) (void);
62  SWIsltsResult (*open) (SWIsltsHand *phLts,
63                         const char *data_filename);
64  SWIsltsResult (*close) (SWIsltsHand hLts);
65  SWIsltsResult (*textToPhone) (SWIsltsHand hLts,
66                                const char *text,
67                                char **output_phone_string,
68                                int *output_phone_len,
69                                int max_phone_len);
70} SWIsltsWrapper;
71
72typedef SWIsltsWrapper * SWIsltsWrapperHand;
73
74SWISLTS_FNDECLARE SWIsltsResult SWIsltsGetWrapper(SWIsltsWrapperHand *phLtsWrap);
75SWISLTS_FNDECLARE SWIsltsResult SWIsltsReleaseWrapper(SWIsltsWrapperHand hLtsWrap);
76
77typedef SWIsltsResult (*pSWIsltsReleaseWrapper)(SWIsltsWrapperHand);
78typedef SWIsltsResult (*pSWIsltsGetWrapper)(SWIsltsWrapperHand *);
79
80SWISLTS_FNDECLARE SWIsltsResult SWIsltsInit(void);
81SWISLTS_FNDECLARE SWIsltsResult SWIsltsTerm(void);
82
83SWISLTS_FNDECLARE SWIsltsResult SWIsltsOpen(SWIsltsHand *phLts,
84                                            const char *data_filename);
85SWISLTS_FNDECLARE SWIsltsResult SWIsltsClose(SWIsltsHand hLts);
86
87SWISLTS_FNDECLARE SWIsltsResult SWIsltsTextToPhone(SWIsltsHand hLts,
88                                                   const char *text,
89                                                   char **output_phone_string,
90                                                   int *output_phone_len,
91                                                   int max_phone_len);
92
93SWISLTS_FNDECLARE SWIsltsResult SWIsltsG2PGetWordTranscriptions(SWIsltsHand hLts,
94                                                               const char *text,
95                                                               SWIsltsTranscription **ppTranscriptions,
96                                                               int *pnNbrOfTranscriptions);
97
98SWISLTS_FNDECLARE SWIsltsResult SWIsltsG2PFreeWordTranscriptions(SWIsltsHand hLts,
99                                                                 SWIsltsTranscription *pTranscriptions);
100#endif  /* _SWI_SLTS_H__ */
101
102
103