📄 de_api.h
字号:
/*
Copyright Motech
*/
#ifndef DE_API_H
#define DE_API_H
#ifdef __cplusplus
extern "C" {
#endif
#define MAX_WORD_SIZE (38) /*the maximum length of a word,the size is temporaryly defined*/
#define MAX_PAGE_SIZE 32
#define MAX_LIB_NUM 31
typedef unsigned int u_INT2;
typedef unsigned short DECHAR, *DESTR;
typedef unsigned char LIBIDX;
typedef enum
{
DE_OK, /* function finished without error.*/
DE_NO_DICT, /* no dictionary assigned.*/
DE_INVALID_DICT, /* dictionary assigned has wrong format.*/
DE_NO_ENOUGH_MEMORY, /* dynamic memory assigned not enough.*/
DE_WORD_NOT_FOUND, /* specified word not found.*/
DE_UNKNOWN /* unspecified error occurred.*/
} DEReturnValue;
typedef enum
{
TYPE_EMPTY = 0, /* no word type or other type*/
TYPE_NOUN = 1, /* noun */
TYPE_PRON, /* pronoun */
TYPE_VI, /* verb intransitive */
TYPE_VT, /* verb transitive */
TYPE_ADJ, /* adjective */
TYPE_ADV, /* sdverb*/
TYPE_PREP, /* preposition */
TYPE_CONJ, /* conjunction */
TYPE_INT, /* interjection*/
TYPE_ABBR, /* abbreviation */
TYPE_USER, /* a word type of user lib */
TYPE_END /* */
} WORDTYPE;
#ifndef BYTE
typedef unsigned char BYTE;
typedef unsigned short WORD;
typedef unsigned long DWORD;
#endif
#ifndef BOOL
typedef int BOOL;
#endif
#ifndef FALSE
#define FALSE 0
#define TRUE 1
#endif
#ifndef NULL
#define NULL (void*)0
#endif
#define DE_HANDLE int
#define DE_CALLBACK_ERROR -1
#define DE_FILE_BEGIN 0
#define DE_FILE_CURRENT 1
#define DE_FILE_END 2
typedef struct
{
void *pRAM;
DE_HANDLE pUserLib; /* it's the full-path of user lib file name.*/
DE_HANDLE *pStandardLib;
BYTE NumofStandardLib;
BYTE PageSize;
DE_HANDLE (*Open)(void*);
int (*Read)(DE_HANDLE hHandle, void* buf, DWORD nLen);
int (*Seek)(DE_HANDLE hHandle, DWORD nOffset, DWORD from);
int (*Write)(DE_HANDLE hHandle, void* buf, DWORD nLen);
int (*Close)(DE_HANDLE hHandle);
} DEData, *LPDEData;
typedef struct tagWORDLIST
{
DESTR pWord; /* pointer to a string */
struct tagWORDLIST *pNext;
} WORDLIST;
typedef struct tagONEEXP
{
BYTE typeofword; /* WORDTYPE: parts of speech */
WORDLIST *interpretation;
struct tagONEEXP *pNext;
} ONEEXP, *ONEEXP_LIST;
typedef struct
{
BYTE dIndex; /* indicate which library the content is from*/
BYTE numofIrregular; /*number of irregularities*/
BYTE numofSynonym; /*number of synonyms*/
BYTE numofAntonym; /*number of antonyms*/
DESTR *pIrregular; /* a series of irregularities */
DESTR *pSynonym; /* a series of synonym */
DESTR *pAntonym; /* a series of Antonym */
DESTR phoneSym; /* phonetic symbol */
DESTR pronunciation;
ONEEXP_LIST explanation; /* a series of explanation */
} ONECONT;
typedef struct tagWCONTENT
{
ONECONT *pContent; /* contents in one dictionary */
struct tagWCONTENT *pNext; /* pointer to next Dictionary */
} WCONTENT, *WCONTENT_LIST;
// normal translation
unsigned long DEGetMemSize( DEData *pData );
unsigned char DEInit(DEData *pData);
unsigned char DETerminate(DEData *pData);
unsigned char DESetScope (DEData *pData, DWORD mask);
unsigned char DESearchWord(DEData *pData, DESTR InputWord, DESTR OutputWord);
unsigned char DEGetWord(DEData *pData, short steps, DESTR pWord);
short DEChangeFocus(DEData *pData, short steps);
unsigned long DEGetWordContentSize(DEData *pData, BYTE flag);
unsigned char DEGetWordContent(DEData *pData, BYTE flag, WCONTENT *content);
//instant translation
unsigned long DEInstantGetWordContentSize(DEData *pData, BYTE flag, DESTR InputWord);
unsigned char DEInstantGetWordContent (DEData *pData, BYTE flag, DESTR InputWord, WCONTENT *content);
//user lib support, not implement now.
unsigned char DELibAddUserWord(DEData *pData, DESTR InWord, DESTR content);
unsigned char DELibDelUserWord(DEData *pData, DESTR InWord);
unsigned char DELibEditUserWord(DEData *pData, DESTR InWord, DESTR content);
unsigned char DELibGetUserWordContent(DEData *pData, unsigned long Index, DESTR OutputWord, DESTR content);
unsigned short DELibGetUserNum(DEData *pData);
unsigned char DELibUserGetWord(DEData *pData, unsigned short nIdx, DECHAR uOut[MAX_WORD_SIZE]);
//spell check support
#define MAX_NEAREST_WORD_NUM 3
unsigned char DECheckSpell(DEData *pData, DESTR InputWord, DECHAR OutputWordList[MAX_NEAREST_WORD_NUM][MAX_WORD_SIZE]);
// recite module
#define DE_CET4 (unsigned char)1
#define DE_CET6 (unsigned char)2
#define DE_TOEFL (unsigned char)4
#define DE_GMAT (unsigned char)8
#define DE_GRE (unsigned char)16
#define DE_IELTS (unsigned char)32
#define DE_SENIOR (unsigned char)64
// bFlag = 0x01, 0x02, 0x04, 0x08, 0x10, ...
// return TRUE if succeed, or return FALSE
BOOL DESetDictFlag(DEData * pData, BYTE bFlag);
// words in the dict heading char from usChBeg to usChEnd
// return TRUE if succeed, or return FALSE
BOOL DESetDictRange(DEData * pData,unsigned short usChBeg, unsigned short usChEnd);
// return the total number of words in the specified dict according to the word range, if set.
DWORD DEGetDictNum(DEData * pData);
// get the specified string by the zero-based index of the specified dict in the specified range.
BOOL DEGetDictString(DEData * pData, DWORD nIndex, DECHAR OutputString[MAX_WORD_SIZE]);
// get the size of explanation by the zero-based index of the specified dict in the specified range.
DWORD DEGetDictContentSize(DEData * pData,DWORD nIndex);
// get the explanation by the zero-based index of the specified dict in the specified range.
BOOL DEGetDictContent(DEData * pData, DWORD nIndex, WCONTENT* content);
////////////////////////////////////////////////
// get the total number of whole dict
BOOL DENumInit(DE_HANDLE hEngLib, DE_HANDLE hChnLib);
DWORD DEGetWholeNum(DEData *pData, BOOL bEng);
DWORD DEGetCurrentIndex(DEData* pData, BOOL* bEng);
BOOL DEGetWordFromIndex(DEData * pData, DWORD dwInIndex, DESTR OutputWord);
DWORD DEGetIndexFromWord(DEData* pData, DESTR InputWord);
BOOL DESetVoiceData(DEData* pData, DE_HANDLE hVoice);
BOOL DEGetVoiceRangeFromWord(DEData* pData, DESTR InputWord, DWORD* dwOutputBeg, DWORD* dwOutputEnd);
#ifdef __cplusplus
}
#endif
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -