Auto update
This commit is contained in:
parent
642312f996
commit
6672fa19bd
4907 changed files with 206456 additions and 171700 deletions
|
|
@ -1,39 +1,3 @@
|
|||
/*
|
||||
* chewing-compat.h
|
||||
*
|
||||
* Copyright (c) 2014
|
||||
* libchewing Core Team. See ChangeLog for details.
|
||||
*
|
||||
* See the file "COPYING" for information on usage and redistribution
|
||||
* of this file.
|
||||
*/
|
||||
#warning "This header is deprecated. Include <chewing.h> directly."
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
#ifndef _CHEWING_COMPAT_
|
||||
#define _CHEWING_COMPAT_
|
||||
/* *INDENT-ON* */
|
||||
|
||||
/** @brief indicate the internal encoding of data processing.
|
||||
* @since 0.3.0
|
||||
*/
|
||||
#define LIBCHEWING_ENCODING "UTF-8"
|
||||
|
||||
/* deprecated function. for API compatibility */
|
||||
CHEWING_API int chewing_zuin_Check(const ChewingContext *ctx)
|
||||
DEPRECATED_FOR(chewing_bopomofo_Check);
|
||||
CHEWING_API char *chewing_zuin_String(const ChewingContext *, int *zuin_count)
|
||||
DEPRECATED_FOR(chewing_bopomofo_String_static);
|
||||
|
||||
CHEWING_API int chewing_Init(const char *dataPath, const char *hashPath)
|
||||
DEPRECATED;
|
||||
CHEWING_API void chewing_Terminate() DEPRECATED;
|
||||
CHEWING_API int chewing_Configure(ChewingContext *ctx, ChewingConfigData * pcd)
|
||||
DEPRECATED_FOR(chewing_set_*);
|
||||
CHEWING_API void chewing_set_hsuSelKeyType(ChewingContext *ctx, int mode)
|
||||
DEPRECATED_FOR(chewing_set_selKey);
|
||||
CHEWING_API int chewing_get_hsuSelKeyType(ChewingContext *ctx)
|
||||
DEPRECATED_FOR(chewing_get_selKey);
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
#endif
|
||||
/* *INDENT-ON* */
|
||||
#include "chewing.h"
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,587 +1,3 @@
|
|||
/*
|
||||
* chewingio.h
|
||||
*
|
||||
* Copyright (c) 1999, 2000, 2001
|
||||
* Lu-chuan Kung and Kang-pen Chen.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Copyright (c) 2004, 2005, 2008
|
||||
* libchewing Core Team. See ChangeLog for details.
|
||||
*
|
||||
* See the file "COPYING" for information on usage and redistribution
|
||||
* of this file.
|
||||
*/
|
||||
#warning "This header is deprecated. Include <chewing.h> directly."
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
#ifndef _CHEWING_IO_H
|
||||
#define _CHEWING_IO_H
|
||||
/* *INDENT-ON* */
|
||||
|
||||
/*! \file chewingio.h
|
||||
* \brief Chewing I/O module
|
||||
* \author libchewing Core Team
|
||||
*/
|
||||
|
||||
#ifdef WITH_RUST
|
||||
# include "chewing_rs.h"
|
||||
#else
|
||||
# include "global.h"
|
||||
#endif
|
||||
|
||||
#define KEYSTROKE_IGNORE 1
|
||||
#define KEYSTROKE_COMMIT 2
|
||||
#define KEYSTROKE_BELL 4
|
||||
#define KEYSTROKE_ABSORB 8
|
||||
|
||||
/*! \name Series of functions handling key stroke.
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Handle the input key stroke: Space
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Space(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Escape
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Esc(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Enter/Return
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Enter(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Delete
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Del(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Backspace
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Backspace(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Tab
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Tab(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Shift + Left
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_ShiftLeft(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Left
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Left(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Shift + Right
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_ShiftRight(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Right
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Right(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Up
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Up(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Home
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Home(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: End
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
|
||||
CHEWING_API int chewing_handle_End(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: PageUp
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_PageUp(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: PageDown
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_PageDown(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Down
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Down(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Capslock
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Capslock(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: casual key
|
||||
* @param ctx Chewing IM context
|
||||
* @param key scan code of key stroke
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Default(ChewingContext *ctx, int key);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Ctrl + Number-key
|
||||
* @param ctx Chewing IM context
|
||||
* @param key scan code of number key
|
||||
*/
|
||||
CHEWING_API int chewing_handle_CtrlNum(ChewingContext *ctx, int key);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Shift + Space
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_ShiftSpace(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: double Tab
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_DblTab(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Numlock (keypad)
|
||||
* @param ctx Chewing IM context
|
||||
* @param key scan code of number key
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Numlock(ChewingContext *ctx, int key);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Chewing IM Instance Management
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Create new handle of the instance for Chewing IM
|
||||
* @see chewing_delete()
|
||||
*/
|
||||
CHEWING_API ChewingContext *chewing_new();
|
||||
|
||||
/**
|
||||
* @brief Release the handle and internal memory by given Chewing instance
|
||||
* @see chewing_new()
|
||||
*
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API void chewing_delete(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Release memory allocated used by given pointer used in APIs
|
||||
*/
|
||||
CHEWING_API void chewing_free(void *);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Chewing IM Setup
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Reset all settings
|
||||
*
|
||||
* @param ctx
|
||||
* @return If successed than return 0
|
||||
*/
|
||||
CHEWING_API int chewing_Reset(ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
/*! \name Keyboard mapping
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set keyboard mapping type
|
||||
*
|
||||
* @param ctx
|
||||
* @param kbtype index number of keyboard mapping type from KBStr2Num
|
||||
* @return If successed then return 0
|
||||
*/
|
||||
CHEWING_API int chewing_set_KBType(ChewingContext *ctx, int kbtype);
|
||||
|
||||
/**
|
||||
* @brief Get keyboard mapping type
|
||||
*
|
||||
* @param ctx
|
||||
* @return If successed then return keyboard mapping type from KBStr2Num
|
||||
*/
|
||||
CHEWING_API int chewing_get_KBType(const ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Get keyboard mapping type in C-style string format
|
||||
* @see KBStr2Num()
|
||||
*
|
||||
* @param ctx
|
||||
* @return The name of the current keyboard layout. The caller must free it.
|
||||
*/
|
||||
CHEWING_API char *chewing_get_KBString(const ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Get the index number of keyboard mapping type from given string
|
||||
*
|
||||
* @param str[] name of kbtype eg. "KB_HSU"
|
||||
*/
|
||||
CHEWING_API int chewing_KBStr2Num(const char str[]);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Operating language mode of Chewing IM
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set the operating language mode of Chewing IM.
|
||||
*
|
||||
* @param ctx
|
||||
* @param mode CHINESE_MODE or ENGLISH_MODE
|
||||
*/
|
||||
CHEWING_API void chewing_set_ChiEngMode(ChewingContext *ctx, int mode);
|
||||
|
||||
/**
|
||||
* @brief Get current operating language mode: English / Chinese
|
||||
*
|
||||
* @param ctx
|
||||
*
|
||||
* @return CHINESE_MODE or ENGLISH_MODE
|
||||
*/
|
||||
CHEWING_API int chewing_get_ChiEngMode(const ChewingContext *ctx);
|
||||
|
||||
/*@*/
|
||||
|
||||
|
||||
/*! \name Shape mode of output symbols
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set the shape mode of output symbols: full-shape / half-shape
|
||||
*
|
||||
* @param ctx
|
||||
* @param mode FULLSHAPE_MODE or HALFSHAPE_MODE
|
||||
*/
|
||||
CHEWING_API void chewing_set_ShapeMode(ChewingContext *ctx, int mode);
|
||||
|
||||
/**
|
||||
* @brief Get current shape mode of output symbols
|
||||
*
|
||||
* @param ctx
|
||||
*
|
||||
* @return FULLSHAPE_MODE or HALFSHAPE_MODE
|
||||
*/
|
||||
CHEWING_API int chewing_get_ShapeMode(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Number of selection candidate per page
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set the number of selection candidate per page
|
||||
*
|
||||
* @param ctx
|
||||
* @param n number of selection candidate
|
||||
*/
|
||||
CHEWING_API void chewing_set_candPerPage(ChewingContext *ctx, int n);
|
||||
|
||||
/**
|
||||
* @brief Get the number of selection candidate per page
|
||||
*
|
||||
* @param ctx
|
||||
*/
|
||||
CHEWING_API int chewing_get_candPerPage(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Maximum length of Chinese symbols
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set the maximum length of Chinese symbols
|
||||
*
|
||||
* @param ctx
|
||||
* @param n maximum length
|
||||
*/
|
||||
CHEWING_API void chewing_set_maxChiSymbolLen(ChewingContext *ctx, int n);
|
||||
|
||||
/**
|
||||
* @brief Get the maximum length of Chinese symbols
|
||||
*
|
||||
* @param ctx
|
||||
*/
|
||||
CHEWING_API int chewing_get_maxChiSymbolLen(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Key sequence for selecting phrases
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set the key sequence for selecting phrases
|
||||
*
|
||||
* @param ctx
|
||||
* @param selkeys
|
||||
* @param len
|
||||
*/
|
||||
CHEWING_API void chewing_set_selKey(ChewingContext *ctx, const int *selkeys, int len);
|
||||
|
||||
/**
|
||||
* @brief Get the key sequence for selecting phrases
|
||||
*
|
||||
* @param ctx
|
||||
*/
|
||||
CHEWING_API int *chewing_get_selKey(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Direction of adding new user-defined phrases
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set the direction of adding new user-defined phrases
|
||||
*
|
||||
* @param ctx
|
||||
* @param direction
|
||||
*/
|
||||
CHEWING_API void chewing_set_addPhraseDirection(ChewingContext *ctx, int direction);
|
||||
|
||||
/**
|
||||
* @brief Get the direction of adding new user-defined phrases
|
||||
*
|
||||
* @param ctx
|
||||
*/
|
||||
CHEWING_API int chewing_get_addPhraseDirection(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Behavior whether if space key is regarded as selection key
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set the behavior whether if space key is regarded as selection key
|
||||
*
|
||||
* @param ctx
|
||||
* @param mode
|
||||
*/
|
||||
CHEWING_API void chewing_set_spaceAsSelection(ChewingContext *ctx, int mode);
|
||||
|
||||
/**
|
||||
* @brief Get the behavior if space key is regarded as selection key or not
|
||||
*
|
||||
* @param ctx
|
||||
*/
|
||||
CHEWING_API int chewing_get_spaceAsSelection(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Behavior whether if Escape should clean all buffer
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set the behavior whether if Escape key should clean all buffer
|
||||
*
|
||||
* @param ctx
|
||||
* @param mode
|
||||
*/
|
||||
CHEWING_API void chewing_set_escCleanAllBuf(ChewingContext *ctx, int mode);
|
||||
|
||||
/**
|
||||
* @brief Get the behavior whether if Escape key should clean all buffer
|
||||
*
|
||||
* @param ctx
|
||||
*/
|
||||
CHEWING_API int chewing_get_escCleanAllBuf(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Behavior of automatically shifting cursor after selection
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set the behavior of automatically shifting cursor after selection
|
||||
*
|
||||
* @param ctx
|
||||
* @param mode
|
||||
*/
|
||||
CHEWING_API void chewing_set_autoShiftCur(ChewingContext *ctx, int mode);
|
||||
|
||||
/**
|
||||
* @brief Get the behavior of automatically shifting cursor after selection
|
||||
*
|
||||
* @param ctx
|
||||
*/
|
||||
CHEWING_API int chewing_get_autoShiftCur(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Operating mode during easy symbol input
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set the operating mode during easy symbol input
|
||||
*
|
||||
* @param ctx
|
||||
* @param mode
|
||||
*/
|
||||
CHEWING_API void chewing_set_easySymbolInput(ChewingContext *ctx, int mode);
|
||||
|
||||
/**
|
||||
* @brief Get the operating mode during easy symbol input
|
||||
*
|
||||
* @param ctx
|
||||
*/
|
||||
CHEWING_API int chewing_get_easySymbolInput(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Behavior for phrase choice to be rearward or not
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set the behavior for phrase choice to be rearward or not
|
||||
*
|
||||
* @param ctx
|
||||
* @param mode
|
||||
*/
|
||||
CHEWING_API void chewing_set_phraseChoiceRearward(ChewingContext *ctx, int mode);
|
||||
|
||||
/**
|
||||
* @brief Get the behavior for phrase choice to be rearward or not
|
||||
*
|
||||
* @param ctx
|
||||
*/
|
||||
CHEWING_API int chewing_get_phraseChoiceRearward(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Behavior of automatic learning after committing
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set the behavior of automatic learning
|
||||
*
|
||||
* @param ctx
|
||||
* @param mode AUTOLEARN_ENABLED or AUTOLEARN_DISABLED
|
||||
*/
|
||||
CHEWING_API void chewing_set_autoLearn(ChewingContext *ctx, int mode);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get the behavior of automatic learning
|
||||
*
|
||||
* @param ctx
|
||||
* @return AUTOLEARN_ENABLED or AUTOLEARN_DISABLED
|
||||
*/
|
||||
CHEWING_API int chewing_get_autoLearn(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Phonetic sequence in Chewing internal state machine
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Get phonetic sequence in Chewing internal state machine
|
||||
*
|
||||
* @param ctx
|
||||
*/
|
||||
CHEWING_API unsigned short *chewing_get_phoneSeq(const ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Get the length of phonetic sequence in Chewing internal state machine
|
||||
*
|
||||
* @param ctx
|
||||
*/
|
||||
CHEWING_API int chewing_get_phoneSeqLen(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
CHEWING_API void chewing_set_logger(ChewingContext *ctx,
|
||||
void (*logger) (void *data, int level, const char *fmt, ...), void *data);
|
||||
|
||||
CHEWING_API int chewing_userphrase_enumerate(ChewingContext *ctx);
|
||||
|
||||
CHEWING_API int chewing_userphrase_has_next(ChewingContext *ctx, unsigned int *phrase_len, unsigned int *bopomofo_len);
|
||||
|
||||
CHEWING_API int chewing_userphrase_get(ChewingContext *ctx,
|
||||
char *phrase_buf, unsigned int phrase_len,
|
||||
char *bopomofo_buf, unsigned int bopomofo_len);
|
||||
|
||||
CHEWING_API int chewing_userphrase_add(ChewingContext *ctx, const char *phrase_buf, const char *bopomofo_buf);
|
||||
|
||||
CHEWING_API int chewing_userphrase_remove(ChewingContext *ctx, const char *phrase_buf, const char *bopomofo_buf);
|
||||
|
||||
CHEWING_API int chewing_userphrase_lookup(ChewingContext *ctx, const char *phrase_buf, const char *bopomofo_buf);
|
||||
|
||||
CHEWING_API int chewing_cand_list_first(ChewingContext *ctx);
|
||||
CHEWING_API int chewing_cand_list_last(ChewingContext *ctx);
|
||||
CHEWING_API int chewing_cand_list_has_next(ChewingContext *ctx);
|
||||
CHEWING_API int chewing_cand_list_has_prev(ChewingContext *ctx);
|
||||
CHEWING_API int chewing_cand_list_next(ChewingContext *ctx);
|
||||
CHEWING_API int chewing_cand_list_prev(ChewingContext *ctx);
|
||||
|
||||
CHEWING_API int chewing_commit_preedit_buf(ChewingContext *ctx);
|
||||
CHEWING_API int chewing_clean_preedit_buf(ChewingContext *ctx);
|
||||
|
||||
CHEWING_API int chewing_clean_bopomofo_buf(ChewingContext *ctx);
|
||||
|
||||
CHEWING_API ChewingContext *chewing_new2(const char *syspath,
|
||||
const char *userpath,
|
||||
void (*logger) (void *data, int level, const char *fmt, ...),
|
||||
void *loggerdata);
|
||||
|
||||
CHEWING_API int chewing_phone_to_bopomofo(unsigned short phone, char *buf, unsigned short len);
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
#endif /* _CHEWING_IO_H */
|
||||
/* *INDENT-ON* */
|
||||
#include "chewing.h"
|
||||
|
|
@ -1,124 +1,3 @@
|
|||
/*
|
||||
* global.h
|
||||
*
|
||||
* Copyright (c) 1999, 2000, 2001
|
||||
* Lu-chuan Kung and Kang-pen Chen.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Copyright (c) 2004, 2005, 2006, 2008, 2011
|
||||
* libchewing Core Team. See ChangeLog for details.
|
||||
*
|
||||
* See the file "COPYING" for information on usage and redistribution
|
||||
* of this file.
|
||||
*/
|
||||
#warning "This header is deprecated. Include <chewing.h> directly."
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
#ifndef _CHEWING_GLOBAL_H
|
||||
#define _CHEWING_GLOBAL_H
|
||||
/* *INDENT-ON* */
|
||||
|
||||
/*! \file global.h
|
||||
* \brief Chewing Global Definitions
|
||||
* \author libchewing Core Team
|
||||
*/
|
||||
|
||||
#define CHINESE_MODE 1
|
||||
#define SYMBOL_MODE 0
|
||||
#define FULLSHAPE_MODE 1
|
||||
#define HALFSHAPE_MODE 0
|
||||
#define AUTOLEARN_DISABLED 1
|
||||
#define AUTOLEARN_ENABLED 0
|
||||
|
||||
/* specified to Chewing API */
|
||||
#if defined(_WIN32) || defined(_WIN64) || defined(_WIN32_WCE)
|
||||
# define CHEWING_DLL_IMPORT __declspec(dllimport)
|
||||
# define CHEWING_DLL_EXPORT __declspec(dllexport)
|
||||
# ifdef CHEWINGDLL_EXPORTS
|
||||
# define CHEWING_API CHEWING_DLL_EXPORT
|
||||
# define CHEWING_PRIVATE
|
||||
# elif CHEWINGDLL_IMPORTS
|
||||
# define CHEWING_API CHEWING_DLL_IMPORT
|
||||
# define CHEWING_PRIVATE
|
||||
# else
|
||||
# define CHEWING_API
|
||||
# define CHEWING_PRIVATE
|
||||
# endif
|
||||
#elif (__GNUC__ > 3) && (defined(__ELF__) || defined(__PIC__))
|
||||
# define CHEWING_API __attribute__((__visibility__("default")))
|
||||
# define CHEWING_PRIVATE __attribute__((__visibility__("hidden")))
|
||||
#else
|
||||
# define CHEWING_API
|
||||
# define CHEWING_PRIVATE
|
||||
#endif
|
||||
|
||||
#ifndef UNUSED
|
||||
# if defined(__GNUC__) /* gcc specific */
|
||||
# define UNUSED __attribute__((unused))
|
||||
# else
|
||||
# define UNUSED
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef DEPRECATED
|
||||
# if defined(__GNUC__) && __GNUC__ > 3 || \
|
||||
(__GNUC__ == 3 && __GNUC_MINOR__ >= 1) /* gcc specific */
|
||||
# define DEPRECATED __attribute__((deprecated))
|
||||
# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
|
||||
# define DEPRECATED_FOR(f) \
|
||||
__attribute__((deprecated("Use " #f " instead")))
|
||||
# else
|
||||
# define DEPRECATED_FOR(f) DEPRECATED
|
||||
# endif
|
||||
# else
|
||||
# define DEPRECATED
|
||||
# define DEPRECATED_FOR(f)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define MIN_SELKEY 1
|
||||
#define MAX_SELKEY 10
|
||||
|
||||
#define CHEWING_LOG_VERBOSE 1
|
||||
#define CHEWING_LOG_DEBUG 2
|
||||
#define CHEWING_LOG_INFO 3
|
||||
#define CHEWING_LOG_WARN 4
|
||||
#define CHEWING_LOG_ERROR 5
|
||||
|
||||
/**
|
||||
* @deprecated Use chewing_set_ series of functions to set parameters instead.
|
||||
*/
|
||||
typedef struct ChewingConfigData {
|
||||
int candPerPage;
|
||||
int maxChiSymbolLen;
|
||||
int selKey[MAX_SELKEY];
|
||||
int bAddPhraseForward;
|
||||
int bSpaceAsSelection;
|
||||
int bEscCleanAllBuf;
|
||||
int bAutoShiftCur;
|
||||
int bEasySymbolInput;
|
||||
int bPhraseChoiceRearward;
|
||||
int hsuSelKeyType; // Deprecated.
|
||||
} ChewingConfigData;
|
||||
|
||||
typedef struct IntervalType {
|
||||
/*@{ */
|
||||
int from; /**< starting position of certain interval */
|
||||
int to; /**< ending position of certain interval */
|
||||
/*@} */
|
||||
} IntervalType;
|
||||
|
||||
/** @brief context handle used for Chewing IM APIs
|
||||
*/
|
||||
typedef struct ChewingContext ChewingContext;
|
||||
|
||||
/** @brief use "asdfjkl789" as selection key
|
||||
*/
|
||||
#define HSU_SELKEY_TYPE1 1
|
||||
|
||||
/** @brief use "asdfzxcv89" as selection key
|
||||
*/
|
||||
#define HSU_SELKEY_TYPE2 2
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
#endif
|
||||
/* *INDENT-ON* */
|
||||
#include "chewing.h"
|
||||
|
|
@ -1,117 +1,3 @@
|
|||
/*
|
||||
* mod_aux.h
|
||||
*
|
||||
* Copyright (c) 2005, 2008
|
||||
* libchewing Core Team. See ChangeLog for details.
|
||||
*
|
||||
* See the file "COPYING" for information on usage and redistribution
|
||||
* of this file.
|
||||
*/
|
||||
#warning "This header is deprecated. Include <chewing.h> directly."
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
#ifndef CHEWING_MOD_AUX_H
|
||||
#define CHEWING_MOD_AUX_H
|
||||
/* *INDENT-ON* */
|
||||
|
||||
/*! \file mod_aux.h
|
||||
* \brief Auxiliary module
|
||||
* \author libchewing Core Team
|
||||
*/
|
||||
|
||||
#ifdef WITH_RUST
|
||||
# include "chewing_rs.h"
|
||||
#else
|
||||
# include "global.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Chewing the state for input context during commit process
|
||||
* @param ctx handle to Chewing IM context
|
||||
* @retval TRUE if its currnet input state is at the "end-of-a-char"
|
||||
*/
|
||||
CHEWING_API int chewing_commit_Check(const ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Get current commit string regardless of current input state
|
||||
* @param ctx handle to Chewing IM context
|
||||
*
|
||||
* Always returns a char pointer, caller must free it.
|
||||
*/
|
||||
CHEWING_API char *chewing_commit_String(const ChewingContext *ctx);
|
||||
CHEWING_API const char *chewing_commit_String_static(const ChewingContext *ctx);
|
||||
|
||||
|
||||
/*! \name Preedit string buffer
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
CHEWING_API char *chewing_buffer_String(const ChewingContext *ctx);
|
||||
CHEWING_API const char *chewing_buffer_String_static(const ChewingContext *ctx);
|
||||
CHEWING_API int chewing_buffer_Check(const ChewingContext *ctx);
|
||||
CHEWING_API int chewing_buffer_Len(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*@{*/
|
||||
CHEWING_API const char *chewing_bopomofo_String_static(const ChewingContext *ctx);
|
||||
CHEWING_API int chewing_bopomofo_Check(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
CHEWING_API int chewing_cursor_Current(const ChewingContext *ctx);
|
||||
|
||||
/*@{*/
|
||||
CHEWING_API int chewing_cand_CheckDone(const ChewingContext *ctx);
|
||||
CHEWING_API int chewing_cand_TotalPage(const ChewingContext *ctx);
|
||||
CHEWING_API int chewing_cand_ChoicePerPage(const ChewingContext *ctx);
|
||||
CHEWING_API int chewing_cand_TotalChoice(const ChewingContext *ctx);
|
||||
CHEWING_API int chewing_cand_CurrentPage(const ChewingContext *ctx);
|
||||
CHEWING_API void chewing_cand_Enumerate(ChewingContext *ctx);
|
||||
CHEWING_API int chewing_cand_hasNext(ChewingContext *ctx);
|
||||
CHEWING_API char *chewing_cand_String(ChewingContext *ctx);
|
||||
CHEWING_API const char *chewing_cand_String_static(ChewingContext *ctx);
|
||||
CHEWING_API char *chewing_cand_string_by_index(ChewingContext *ctx, int index);
|
||||
CHEWING_API const char *chewing_cand_string_by_index_static(ChewingContext *ctx, int index);
|
||||
CHEWING_API int chewing_cand_choose_by_index(ChewingContext *ctx, int index);
|
||||
CHEWING_API int chewing_cand_open(ChewingContext *ctx);
|
||||
CHEWING_API int chewing_cand_close(ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*@{*/
|
||||
CHEWING_API void chewing_interval_Enumerate(ChewingContext *ctx);
|
||||
CHEWING_API int chewing_interval_hasNext(ChewingContext *ctx);
|
||||
CHEWING_API void chewing_interval_Get(ChewingContext *ctx, IntervalType * it);
|
||||
|
||||
/*@}*/
|
||||
|
||||
/*@{*/
|
||||
CHEWING_API int chewing_aux_Check(const ChewingContext *ctx);
|
||||
CHEWING_API int chewing_aux_Length(const ChewingContext *ctx);
|
||||
CHEWING_API char *chewing_aux_String(const ChewingContext *ctx);
|
||||
CHEWING_API const char *chewing_aux_String_static(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*@{*/
|
||||
CHEWING_API int chewing_keystroke_CheckIgnore(const ChewingContext *ctx);
|
||||
CHEWING_API int chewing_keystroke_CheckAbsorb(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*@{*/
|
||||
CHEWING_API int chewing_kbtype_Total(const ChewingContext *ctx);
|
||||
CHEWING_API void chewing_kbtype_Enumerate(ChewingContext *ctx);
|
||||
CHEWING_API int chewing_kbtype_hasNext(ChewingContext *ctx);
|
||||
CHEWING_API char *chewing_kbtype_String(ChewingContext *ctx);
|
||||
CHEWING_API const char *chewing_kbtype_String_static(ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
#endif /* CHEWING_MOD_AUX_H */
|
||||
/* *INDENT-ON* */
|
||||
#include "chewing.h"
|
||||
28
libchewing/arm64-v8a/lib/cmake/Chewing/ChewingConfig.cmake
Normal file
28
libchewing/arm64-v8a/lib/cmake/Chewing/ChewingConfig.cmake
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
|
||||
####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() #######
|
||||
####### Any changes to this file will be overwritten by the next CMake run ####
|
||||
####### The input file was ChewingConfig.cmake.in ########
|
||||
|
||||
get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE)
|
||||
|
||||
macro(set_and_check _var _file)
|
||||
set(${_var} "${_file}")
|
||||
if(NOT EXISTS "${_file}")
|
||||
message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(check_required_components _NAME)
|
||||
foreach(comp ${${_NAME}_FIND_COMPONENTS})
|
||||
if(NOT ${_NAME}_${comp}_FOUND)
|
||||
if(${_NAME}_FIND_REQUIRED_${comp})
|
||||
set(${_NAME}_FOUND FALSE)
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
####################################################################################
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/ChewingTargets.cmake")
|
||||
check_required_components(Chewing)
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
# This is a basic version file for the Config-mode of find_package().
|
||||
# It is used by write_basic_package_version_file() as input file for configure_file()
|
||||
# to create a version-file which can be installed along a config.cmake file.
|
||||
#
|
||||
# The created file sets PACKAGE_VERSION_EXACT if the current version string and
|
||||
# the requested version string are exactly the same and it sets
|
||||
# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version,
|
||||
# but only if the requested major version is the same as the current one.
|
||||
# The variable CVF_VERSION must be set before calling configure_file().
|
||||
|
||||
|
||||
set(PACKAGE_VERSION "a6a8fa4-dirty")
|
||||
|
||||
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
else()
|
||||
|
||||
if("a6a8fa4-dirty" MATCHES "^([0-9]+)\\.")
|
||||
set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}")
|
||||
if(NOT CVF_VERSION_MAJOR VERSION_EQUAL 0)
|
||||
string(REGEX REPLACE "^0+" "" CVF_VERSION_MAJOR "${CVF_VERSION_MAJOR}")
|
||||
endif()
|
||||
else()
|
||||
set(CVF_VERSION_MAJOR "a6a8fa4-dirty")
|
||||
endif()
|
||||
|
||||
if(PACKAGE_FIND_VERSION_RANGE)
|
||||
# both endpoints of the range must have the expected major version
|
||||
math (EXPR CVF_VERSION_MAJOR_NEXT "${CVF_VERSION_MAJOR} + 1")
|
||||
if (NOT PACKAGE_FIND_VERSION_MIN_MAJOR STREQUAL CVF_VERSION_MAJOR
|
||||
OR ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND NOT PACKAGE_FIND_VERSION_MAX_MAJOR STREQUAL CVF_VERSION_MAJOR)
|
||||
OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND NOT PACKAGE_FIND_VERSION_MAX VERSION_LESS_EQUAL CVF_VERSION_MAJOR_NEXT)))
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
elseif(PACKAGE_FIND_VERSION_MIN_MAJOR STREQUAL CVF_VERSION_MAJOR
|
||||
AND ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_LESS_EQUAL PACKAGE_FIND_VERSION_MAX)
|
||||
OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION_MAX)))
|
||||
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||
else()
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
endif()
|
||||
else()
|
||||
if(PACKAGE_FIND_VERSION_MAJOR STREQUAL CVF_VERSION_MAJOR)
|
||||
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||
else()
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
endif()
|
||||
|
||||
if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
|
||||
set(PACKAGE_VERSION_EXACT TRUE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
|
||||
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "8" STREQUAL "")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
|
||||
if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "8")
|
||||
math(EXPR installedBits "8 * 8")
|
||||
set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
|
||||
set(PACKAGE_VERSION_UNSUITABLE TRUE)
|
||||
endif()
|
||||
107
libchewing/arm64-v8a/lib/cmake/Chewing/ChewingTargets.cmake
Normal file
107
libchewing/arm64-v8a/lib/cmake/Chewing/ChewingTargets.cmake
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
# Generated by CMake
|
||||
|
||||
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.8)
|
||||
message(FATAL_ERROR "CMake >= 3.0.0 required")
|
||||
endif()
|
||||
if(CMAKE_VERSION VERSION_LESS "3.0.0")
|
||||
message(FATAL_ERROR "CMake >= 3.0.0 required")
|
||||
endif()
|
||||
cmake_policy(PUSH)
|
||||
cmake_policy(VERSION 3.0.0...3.29)
|
||||
#----------------------------------------------------------------
|
||||
# Generated CMake target import file.
|
||||
#----------------------------------------------------------------
|
||||
|
||||
# Commands may need to know the format version.
|
||||
set(CMAKE_IMPORT_FILE_VERSION 1)
|
||||
|
||||
# Protect against multiple inclusion, which would fail when already imported targets are added once more.
|
||||
set(_cmake_targets_defined "")
|
||||
set(_cmake_targets_not_defined "")
|
||||
set(_cmake_expected_targets "")
|
||||
foreach(_cmake_expected_target IN ITEMS Chewing::chewing_capi)
|
||||
list(APPEND _cmake_expected_targets "${_cmake_expected_target}")
|
||||
if(TARGET "${_cmake_expected_target}")
|
||||
list(APPEND _cmake_targets_defined "${_cmake_expected_target}")
|
||||
else()
|
||||
list(APPEND _cmake_targets_not_defined "${_cmake_expected_target}")
|
||||
endif()
|
||||
endforeach()
|
||||
unset(_cmake_expected_target)
|
||||
if(_cmake_targets_defined STREQUAL _cmake_expected_targets)
|
||||
unset(_cmake_targets_defined)
|
||||
unset(_cmake_targets_not_defined)
|
||||
unset(_cmake_expected_targets)
|
||||
unset(CMAKE_IMPORT_FILE_VERSION)
|
||||
cmake_policy(POP)
|
||||
return()
|
||||
endif()
|
||||
if(NOT _cmake_targets_defined STREQUAL "")
|
||||
string(REPLACE ";" ", " _cmake_targets_defined_text "${_cmake_targets_defined}")
|
||||
string(REPLACE ";" ", " _cmake_targets_not_defined_text "${_cmake_targets_not_defined}")
|
||||
message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_cmake_targets_defined_text}\nTargets not yet defined: ${_cmake_targets_not_defined_text}\n")
|
||||
endif()
|
||||
unset(_cmake_targets_defined)
|
||||
unset(_cmake_targets_not_defined)
|
||||
unset(_cmake_expected_targets)
|
||||
|
||||
|
||||
# Compute the installation prefix relative to this file.
|
||||
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
|
||||
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
|
||||
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
|
||||
if(_IMPORT_PREFIX STREQUAL "/")
|
||||
set(_IMPORT_PREFIX "")
|
||||
endif()
|
||||
|
||||
# Create imported target Chewing::chewing_capi
|
||||
add_library(Chewing::chewing_capi INTERFACE IMPORTED)
|
||||
|
||||
set_target_properties(Chewing::chewing_capi PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
|
||||
INTERFACE_LINK_LIBRARIES "chewing_capi-static"
|
||||
)
|
||||
|
||||
# Load information for each installed configuration.
|
||||
file(GLOB _cmake_config_files "${CMAKE_CURRENT_LIST_DIR}/ChewingTargets-*.cmake")
|
||||
foreach(_cmake_config_file IN LISTS _cmake_config_files)
|
||||
include("${_cmake_config_file}")
|
||||
endforeach()
|
||||
unset(_cmake_config_file)
|
||||
unset(_cmake_config_files)
|
||||
|
||||
# Cleanup temporary variables.
|
||||
set(_IMPORT_PREFIX)
|
||||
|
||||
# Loop over all imported files and verify that they actually exist
|
||||
foreach(_cmake_target IN LISTS _cmake_import_check_targets)
|
||||
if(CMAKE_VERSION VERSION_LESS "3.28"
|
||||
OR NOT DEFINED _cmake_import_check_xcframework_for_${_cmake_target}
|
||||
OR NOT IS_DIRECTORY "${_cmake_import_check_xcframework_for_${_cmake_target}}")
|
||||
foreach(_cmake_file IN LISTS "_cmake_import_check_files_for_${_cmake_target}")
|
||||
if(NOT EXISTS "${_cmake_file}")
|
||||
message(FATAL_ERROR "The imported target \"${_cmake_target}\" references the file
|
||||
\"${_cmake_file}\"
|
||||
but this file does not exist. Possible reasons include:
|
||||
* The file was deleted, renamed, or moved to another location.
|
||||
* An install or uninstall procedure did not complete successfully.
|
||||
* The installation package was faulty and contained
|
||||
\"${CMAKE_CURRENT_LIST_FILE}\"
|
||||
but not all the files it references.
|
||||
")
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
unset(_cmake_file)
|
||||
unset("_cmake_import_check_files_for_${_cmake_target}")
|
||||
endforeach()
|
||||
unset(_cmake_target)
|
||||
unset(_cmake_import_check_targets)
|
||||
|
||||
# This file does not depend on other imported targets which have
|
||||
# been exported from the same project but in a separate export set.
|
||||
|
||||
# Commands beyond this point should not need to know the version.
|
||||
set(CMAKE_IMPORT_FILE_VERSION)
|
||||
cmake_policy(POP)
|
||||
Binary file not shown.
BIN
libchewing/arm64-v8a/lib/libchewing_capi.a
Normal file
BIN
libchewing/arm64-v8a/lib/libchewing_capi.a
Normal file
Binary file not shown.
|
|
@ -1,39 +1,3 @@
|
|||
/*
|
||||
* chewing-compat.h
|
||||
*
|
||||
* Copyright (c) 2014
|
||||
* libchewing Core Team. See ChangeLog for details.
|
||||
*
|
||||
* See the file "COPYING" for information on usage and redistribution
|
||||
* of this file.
|
||||
*/
|
||||
#warning "This header is deprecated. Include <chewing.h> directly."
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
#ifndef _CHEWING_COMPAT_
|
||||
#define _CHEWING_COMPAT_
|
||||
/* *INDENT-ON* */
|
||||
|
||||
/** @brief indicate the internal encoding of data processing.
|
||||
* @since 0.3.0
|
||||
*/
|
||||
#define LIBCHEWING_ENCODING "UTF-8"
|
||||
|
||||
/* deprecated function. for API compatibility */
|
||||
CHEWING_API int chewing_zuin_Check(const ChewingContext *ctx)
|
||||
DEPRECATED_FOR(chewing_bopomofo_Check);
|
||||
CHEWING_API char *chewing_zuin_String(const ChewingContext *, int *zuin_count)
|
||||
DEPRECATED_FOR(chewing_bopomofo_String_static);
|
||||
|
||||
CHEWING_API int chewing_Init(const char *dataPath, const char *hashPath)
|
||||
DEPRECATED;
|
||||
CHEWING_API void chewing_Terminate() DEPRECATED;
|
||||
CHEWING_API int chewing_Configure(ChewingContext *ctx, ChewingConfigData * pcd)
|
||||
DEPRECATED_FOR(chewing_set_*);
|
||||
CHEWING_API void chewing_set_hsuSelKeyType(ChewingContext *ctx, int mode)
|
||||
DEPRECATED_FOR(chewing_set_selKey);
|
||||
CHEWING_API int chewing_get_hsuSelKeyType(ChewingContext *ctx)
|
||||
DEPRECATED_FOR(chewing_get_selKey);
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
#endif
|
||||
/* *INDENT-ON* */
|
||||
#include "chewing.h"
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,587 +1,3 @@
|
|||
/*
|
||||
* chewingio.h
|
||||
*
|
||||
* Copyright (c) 1999, 2000, 2001
|
||||
* Lu-chuan Kung and Kang-pen Chen.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Copyright (c) 2004, 2005, 2008
|
||||
* libchewing Core Team. See ChangeLog for details.
|
||||
*
|
||||
* See the file "COPYING" for information on usage and redistribution
|
||||
* of this file.
|
||||
*/
|
||||
#warning "This header is deprecated. Include <chewing.h> directly."
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
#ifndef _CHEWING_IO_H
|
||||
#define _CHEWING_IO_H
|
||||
/* *INDENT-ON* */
|
||||
|
||||
/*! \file chewingio.h
|
||||
* \brief Chewing I/O module
|
||||
* \author libchewing Core Team
|
||||
*/
|
||||
|
||||
#ifdef WITH_RUST
|
||||
# include "chewing_rs.h"
|
||||
#else
|
||||
# include "global.h"
|
||||
#endif
|
||||
|
||||
#define KEYSTROKE_IGNORE 1
|
||||
#define KEYSTROKE_COMMIT 2
|
||||
#define KEYSTROKE_BELL 4
|
||||
#define KEYSTROKE_ABSORB 8
|
||||
|
||||
/*! \name Series of functions handling key stroke.
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Handle the input key stroke: Space
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Space(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Escape
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Esc(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Enter/Return
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Enter(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Delete
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Del(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Backspace
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Backspace(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Tab
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Tab(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Shift + Left
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_ShiftLeft(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Left
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Left(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Shift + Right
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_ShiftRight(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Right
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Right(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Up
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Up(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Home
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Home(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: End
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
|
||||
CHEWING_API int chewing_handle_End(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: PageUp
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_PageUp(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: PageDown
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_PageDown(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Down
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Down(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Capslock
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Capslock(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: casual key
|
||||
* @param ctx Chewing IM context
|
||||
* @param key scan code of key stroke
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Default(ChewingContext *ctx, int key);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Ctrl + Number-key
|
||||
* @param ctx Chewing IM context
|
||||
* @param key scan code of number key
|
||||
*/
|
||||
CHEWING_API int chewing_handle_CtrlNum(ChewingContext *ctx, int key);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Shift + Space
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_ShiftSpace(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: double Tab
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_DblTab(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Numlock (keypad)
|
||||
* @param ctx Chewing IM context
|
||||
* @param key scan code of number key
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Numlock(ChewingContext *ctx, int key);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Chewing IM Instance Management
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Create new handle of the instance for Chewing IM
|
||||
* @see chewing_delete()
|
||||
*/
|
||||
CHEWING_API ChewingContext *chewing_new();
|
||||
|
||||
/**
|
||||
* @brief Release the handle and internal memory by given Chewing instance
|
||||
* @see chewing_new()
|
||||
*
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API void chewing_delete(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Release memory allocated used by given pointer used in APIs
|
||||
*/
|
||||
CHEWING_API void chewing_free(void *);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Chewing IM Setup
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Reset all settings
|
||||
*
|
||||
* @param ctx
|
||||
* @return If successed than return 0
|
||||
*/
|
||||
CHEWING_API int chewing_Reset(ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
/*! \name Keyboard mapping
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set keyboard mapping type
|
||||
*
|
||||
* @param ctx
|
||||
* @param kbtype index number of keyboard mapping type from KBStr2Num
|
||||
* @return If successed then return 0
|
||||
*/
|
||||
CHEWING_API int chewing_set_KBType(ChewingContext *ctx, int kbtype);
|
||||
|
||||
/**
|
||||
* @brief Get keyboard mapping type
|
||||
*
|
||||
* @param ctx
|
||||
* @return If successed then return keyboard mapping type from KBStr2Num
|
||||
*/
|
||||
CHEWING_API int chewing_get_KBType(const ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Get keyboard mapping type in C-style string format
|
||||
* @see KBStr2Num()
|
||||
*
|
||||
* @param ctx
|
||||
* @return The name of the current keyboard layout. The caller must free it.
|
||||
*/
|
||||
CHEWING_API char *chewing_get_KBString(const ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Get the index number of keyboard mapping type from given string
|
||||
*
|
||||
* @param str[] name of kbtype eg. "KB_HSU"
|
||||
*/
|
||||
CHEWING_API int chewing_KBStr2Num(const char str[]);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Operating language mode of Chewing IM
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set the operating language mode of Chewing IM.
|
||||
*
|
||||
* @param ctx
|
||||
* @param mode CHINESE_MODE or ENGLISH_MODE
|
||||
*/
|
||||
CHEWING_API void chewing_set_ChiEngMode(ChewingContext *ctx, int mode);
|
||||
|
||||
/**
|
||||
* @brief Get current operating language mode: English / Chinese
|
||||
*
|
||||
* @param ctx
|
||||
*
|
||||
* @return CHINESE_MODE or ENGLISH_MODE
|
||||
*/
|
||||
CHEWING_API int chewing_get_ChiEngMode(const ChewingContext *ctx);
|
||||
|
||||
/*@*/
|
||||
|
||||
|
||||
/*! \name Shape mode of output symbols
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set the shape mode of output symbols: full-shape / half-shape
|
||||
*
|
||||
* @param ctx
|
||||
* @param mode FULLSHAPE_MODE or HALFSHAPE_MODE
|
||||
*/
|
||||
CHEWING_API void chewing_set_ShapeMode(ChewingContext *ctx, int mode);
|
||||
|
||||
/**
|
||||
* @brief Get current shape mode of output symbols
|
||||
*
|
||||
* @param ctx
|
||||
*
|
||||
* @return FULLSHAPE_MODE or HALFSHAPE_MODE
|
||||
*/
|
||||
CHEWING_API int chewing_get_ShapeMode(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Number of selection candidate per page
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set the number of selection candidate per page
|
||||
*
|
||||
* @param ctx
|
||||
* @param n number of selection candidate
|
||||
*/
|
||||
CHEWING_API void chewing_set_candPerPage(ChewingContext *ctx, int n);
|
||||
|
||||
/**
|
||||
* @brief Get the number of selection candidate per page
|
||||
*
|
||||
* @param ctx
|
||||
*/
|
||||
CHEWING_API int chewing_get_candPerPage(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Maximum length of Chinese symbols
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set the maximum length of Chinese symbols
|
||||
*
|
||||
* @param ctx
|
||||
* @param n maximum length
|
||||
*/
|
||||
CHEWING_API void chewing_set_maxChiSymbolLen(ChewingContext *ctx, int n);
|
||||
|
||||
/**
|
||||
* @brief Get the maximum length of Chinese symbols
|
||||
*
|
||||
* @param ctx
|
||||
*/
|
||||
CHEWING_API int chewing_get_maxChiSymbolLen(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Key sequence for selecting phrases
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set the key sequence for selecting phrases
|
||||
*
|
||||
* @param ctx
|
||||
* @param selkeys
|
||||
* @param len
|
||||
*/
|
||||
CHEWING_API void chewing_set_selKey(ChewingContext *ctx, const int *selkeys, int len);
|
||||
|
||||
/**
|
||||
* @brief Get the key sequence for selecting phrases
|
||||
*
|
||||
* @param ctx
|
||||
*/
|
||||
CHEWING_API int *chewing_get_selKey(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Direction of adding new user-defined phrases
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set the direction of adding new user-defined phrases
|
||||
*
|
||||
* @param ctx
|
||||
* @param direction
|
||||
*/
|
||||
CHEWING_API void chewing_set_addPhraseDirection(ChewingContext *ctx, int direction);
|
||||
|
||||
/**
|
||||
* @brief Get the direction of adding new user-defined phrases
|
||||
*
|
||||
* @param ctx
|
||||
*/
|
||||
CHEWING_API int chewing_get_addPhraseDirection(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Behavior whether if space key is regarded as selection key
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set the behavior whether if space key is regarded as selection key
|
||||
*
|
||||
* @param ctx
|
||||
* @param mode
|
||||
*/
|
||||
CHEWING_API void chewing_set_spaceAsSelection(ChewingContext *ctx, int mode);
|
||||
|
||||
/**
|
||||
* @brief Get the behavior if space key is regarded as selection key or not
|
||||
*
|
||||
* @param ctx
|
||||
*/
|
||||
CHEWING_API int chewing_get_spaceAsSelection(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Behavior whether if Escape should clean all buffer
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set the behavior whether if Escape key should clean all buffer
|
||||
*
|
||||
* @param ctx
|
||||
* @param mode
|
||||
*/
|
||||
CHEWING_API void chewing_set_escCleanAllBuf(ChewingContext *ctx, int mode);
|
||||
|
||||
/**
|
||||
* @brief Get the behavior whether if Escape key should clean all buffer
|
||||
*
|
||||
* @param ctx
|
||||
*/
|
||||
CHEWING_API int chewing_get_escCleanAllBuf(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Behavior of automatically shifting cursor after selection
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set the behavior of automatically shifting cursor after selection
|
||||
*
|
||||
* @param ctx
|
||||
* @param mode
|
||||
*/
|
||||
CHEWING_API void chewing_set_autoShiftCur(ChewingContext *ctx, int mode);
|
||||
|
||||
/**
|
||||
* @brief Get the behavior of automatically shifting cursor after selection
|
||||
*
|
||||
* @param ctx
|
||||
*/
|
||||
CHEWING_API int chewing_get_autoShiftCur(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Operating mode during easy symbol input
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set the operating mode during easy symbol input
|
||||
*
|
||||
* @param ctx
|
||||
* @param mode
|
||||
*/
|
||||
CHEWING_API void chewing_set_easySymbolInput(ChewingContext *ctx, int mode);
|
||||
|
||||
/**
|
||||
* @brief Get the operating mode during easy symbol input
|
||||
*
|
||||
* @param ctx
|
||||
*/
|
||||
CHEWING_API int chewing_get_easySymbolInput(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Behavior for phrase choice to be rearward or not
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set the behavior for phrase choice to be rearward or not
|
||||
*
|
||||
* @param ctx
|
||||
* @param mode
|
||||
*/
|
||||
CHEWING_API void chewing_set_phraseChoiceRearward(ChewingContext *ctx, int mode);
|
||||
|
||||
/**
|
||||
* @brief Get the behavior for phrase choice to be rearward or not
|
||||
*
|
||||
* @param ctx
|
||||
*/
|
||||
CHEWING_API int chewing_get_phraseChoiceRearward(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Behavior of automatic learning after committing
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set the behavior of automatic learning
|
||||
*
|
||||
* @param ctx
|
||||
* @param mode AUTOLEARN_ENABLED or AUTOLEARN_DISABLED
|
||||
*/
|
||||
CHEWING_API void chewing_set_autoLearn(ChewingContext *ctx, int mode);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get the behavior of automatic learning
|
||||
*
|
||||
* @param ctx
|
||||
* @return AUTOLEARN_ENABLED or AUTOLEARN_DISABLED
|
||||
*/
|
||||
CHEWING_API int chewing_get_autoLearn(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Phonetic sequence in Chewing internal state machine
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Get phonetic sequence in Chewing internal state machine
|
||||
*
|
||||
* @param ctx
|
||||
*/
|
||||
CHEWING_API unsigned short *chewing_get_phoneSeq(const ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Get the length of phonetic sequence in Chewing internal state machine
|
||||
*
|
||||
* @param ctx
|
||||
*/
|
||||
CHEWING_API int chewing_get_phoneSeqLen(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
CHEWING_API void chewing_set_logger(ChewingContext *ctx,
|
||||
void (*logger) (void *data, int level, const char *fmt, ...), void *data);
|
||||
|
||||
CHEWING_API int chewing_userphrase_enumerate(ChewingContext *ctx);
|
||||
|
||||
CHEWING_API int chewing_userphrase_has_next(ChewingContext *ctx, unsigned int *phrase_len, unsigned int *bopomofo_len);
|
||||
|
||||
CHEWING_API int chewing_userphrase_get(ChewingContext *ctx,
|
||||
char *phrase_buf, unsigned int phrase_len,
|
||||
char *bopomofo_buf, unsigned int bopomofo_len);
|
||||
|
||||
CHEWING_API int chewing_userphrase_add(ChewingContext *ctx, const char *phrase_buf, const char *bopomofo_buf);
|
||||
|
||||
CHEWING_API int chewing_userphrase_remove(ChewingContext *ctx, const char *phrase_buf, const char *bopomofo_buf);
|
||||
|
||||
CHEWING_API int chewing_userphrase_lookup(ChewingContext *ctx, const char *phrase_buf, const char *bopomofo_buf);
|
||||
|
||||
CHEWING_API int chewing_cand_list_first(ChewingContext *ctx);
|
||||
CHEWING_API int chewing_cand_list_last(ChewingContext *ctx);
|
||||
CHEWING_API int chewing_cand_list_has_next(ChewingContext *ctx);
|
||||
CHEWING_API int chewing_cand_list_has_prev(ChewingContext *ctx);
|
||||
CHEWING_API int chewing_cand_list_next(ChewingContext *ctx);
|
||||
CHEWING_API int chewing_cand_list_prev(ChewingContext *ctx);
|
||||
|
||||
CHEWING_API int chewing_commit_preedit_buf(ChewingContext *ctx);
|
||||
CHEWING_API int chewing_clean_preedit_buf(ChewingContext *ctx);
|
||||
|
||||
CHEWING_API int chewing_clean_bopomofo_buf(ChewingContext *ctx);
|
||||
|
||||
CHEWING_API ChewingContext *chewing_new2(const char *syspath,
|
||||
const char *userpath,
|
||||
void (*logger) (void *data, int level, const char *fmt, ...),
|
||||
void *loggerdata);
|
||||
|
||||
CHEWING_API int chewing_phone_to_bopomofo(unsigned short phone, char *buf, unsigned short len);
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
#endif /* _CHEWING_IO_H */
|
||||
/* *INDENT-ON* */
|
||||
#include "chewing.h"
|
||||
|
|
@ -1,124 +1,3 @@
|
|||
/*
|
||||
* global.h
|
||||
*
|
||||
* Copyright (c) 1999, 2000, 2001
|
||||
* Lu-chuan Kung and Kang-pen Chen.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Copyright (c) 2004, 2005, 2006, 2008, 2011
|
||||
* libchewing Core Team. See ChangeLog for details.
|
||||
*
|
||||
* See the file "COPYING" for information on usage and redistribution
|
||||
* of this file.
|
||||
*/
|
||||
#warning "This header is deprecated. Include <chewing.h> directly."
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
#ifndef _CHEWING_GLOBAL_H
|
||||
#define _CHEWING_GLOBAL_H
|
||||
/* *INDENT-ON* */
|
||||
|
||||
/*! \file global.h
|
||||
* \brief Chewing Global Definitions
|
||||
* \author libchewing Core Team
|
||||
*/
|
||||
|
||||
#define CHINESE_MODE 1
|
||||
#define SYMBOL_MODE 0
|
||||
#define FULLSHAPE_MODE 1
|
||||
#define HALFSHAPE_MODE 0
|
||||
#define AUTOLEARN_DISABLED 1
|
||||
#define AUTOLEARN_ENABLED 0
|
||||
|
||||
/* specified to Chewing API */
|
||||
#if defined(_WIN32) || defined(_WIN64) || defined(_WIN32_WCE)
|
||||
# define CHEWING_DLL_IMPORT __declspec(dllimport)
|
||||
# define CHEWING_DLL_EXPORT __declspec(dllexport)
|
||||
# ifdef CHEWINGDLL_EXPORTS
|
||||
# define CHEWING_API CHEWING_DLL_EXPORT
|
||||
# define CHEWING_PRIVATE
|
||||
# elif CHEWINGDLL_IMPORTS
|
||||
# define CHEWING_API CHEWING_DLL_IMPORT
|
||||
# define CHEWING_PRIVATE
|
||||
# else
|
||||
# define CHEWING_API
|
||||
# define CHEWING_PRIVATE
|
||||
# endif
|
||||
#elif (__GNUC__ > 3) && (defined(__ELF__) || defined(__PIC__))
|
||||
# define CHEWING_API __attribute__((__visibility__("default")))
|
||||
# define CHEWING_PRIVATE __attribute__((__visibility__("hidden")))
|
||||
#else
|
||||
# define CHEWING_API
|
||||
# define CHEWING_PRIVATE
|
||||
#endif
|
||||
|
||||
#ifndef UNUSED
|
||||
# if defined(__GNUC__) /* gcc specific */
|
||||
# define UNUSED __attribute__((unused))
|
||||
# else
|
||||
# define UNUSED
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef DEPRECATED
|
||||
# if defined(__GNUC__) && __GNUC__ > 3 || \
|
||||
(__GNUC__ == 3 && __GNUC_MINOR__ >= 1) /* gcc specific */
|
||||
# define DEPRECATED __attribute__((deprecated))
|
||||
# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
|
||||
# define DEPRECATED_FOR(f) \
|
||||
__attribute__((deprecated("Use " #f " instead")))
|
||||
# else
|
||||
# define DEPRECATED_FOR(f) DEPRECATED
|
||||
# endif
|
||||
# else
|
||||
# define DEPRECATED
|
||||
# define DEPRECATED_FOR(f)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define MIN_SELKEY 1
|
||||
#define MAX_SELKEY 10
|
||||
|
||||
#define CHEWING_LOG_VERBOSE 1
|
||||
#define CHEWING_LOG_DEBUG 2
|
||||
#define CHEWING_LOG_INFO 3
|
||||
#define CHEWING_LOG_WARN 4
|
||||
#define CHEWING_LOG_ERROR 5
|
||||
|
||||
/**
|
||||
* @deprecated Use chewing_set_ series of functions to set parameters instead.
|
||||
*/
|
||||
typedef struct ChewingConfigData {
|
||||
int candPerPage;
|
||||
int maxChiSymbolLen;
|
||||
int selKey[MAX_SELKEY];
|
||||
int bAddPhraseForward;
|
||||
int bSpaceAsSelection;
|
||||
int bEscCleanAllBuf;
|
||||
int bAutoShiftCur;
|
||||
int bEasySymbolInput;
|
||||
int bPhraseChoiceRearward;
|
||||
int hsuSelKeyType; // Deprecated.
|
||||
} ChewingConfigData;
|
||||
|
||||
typedef struct IntervalType {
|
||||
/*@{ */
|
||||
int from; /**< starting position of certain interval */
|
||||
int to; /**< ending position of certain interval */
|
||||
/*@} */
|
||||
} IntervalType;
|
||||
|
||||
/** @brief context handle used for Chewing IM APIs
|
||||
*/
|
||||
typedef struct ChewingContext ChewingContext;
|
||||
|
||||
/** @brief use "asdfjkl789" as selection key
|
||||
*/
|
||||
#define HSU_SELKEY_TYPE1 1
|
||||
|
||||
/** @brief use "asdfzxcv89" as selection key
|
||||
*/
|
||||
#define HSU_SELKEY_TYPE2 2
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
#endif
|
||||
/* *INDENT-ON* */
|
||||
#include "chewing.h"
|
||||
|
|
@ -1,117 +1,3 @@
|
|||
/*
|
||||
* mod_aux.h
|
||||
*
|
||||
* Copyright (c) 2005, 2008
|
||||
* libchewing Core Team. See ChangeLog for details.
|
||||
*
|
||||
* See the file "COPYING" for information on usage and redistribution
|
||||
* of this file.
|
||||
*/
|
||||
#warning "This header is deprecated. Include <chewing.h> directly."
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
#ifndef CHEWING_MOD_AUX_H
|
||||
#define CHEWING_MOD_AUX_H
|
||||
/* *INDENT-ON* */
|
||||
|
||||
/*! \file mod_aux.h
|
||||
* \brief Auxiliary module
|
||||
* \author libchewing Core Team
|
||||
*/
|
||||
|
||||
#ifdef WITH_RUST
|
||||
# include "chewing_rs.h"
|
||||
#else
|
||||
# include "global.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Chewing the state for input context during commit process
|
||||
* @param ctx handle to Chewing IM context
|
||||
* @retval TRUE if its currnet input state is at the "end-of-a-char"
|
||||
*/
|
||||
CHEWING_API int chewing_commit_Check(const ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Get current commit string regardless of current input state
|
||||
* @param ctx handle to Chewing IM context
|
||||
*
|
||||
* Always returns a char pointer, caller must free it.
|
||||
*/
|
||||
CHEWING_API char *chewing_commit_String(const ChewingContext *ctx);
|
||||
CHEWING_API const char *chewing_commit_String_static(const ChewingContext *ctx);
|
||||
|
||||
|
||||
/*! \name Preedit string buffer
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
CHEWING_API char *chewing_buffer_String(const ChewingContext *ctx);
|
||||
CHEWING_API const char *chewing_buffer_String_static(const ChewingContext *ctx);
|
||||
CHEWING_API int chewing_buffer_Check(const ChewingContext *ctx);
|
||||
CHEWING_API int chewing_buffer_Len(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*@{*/
|
||||
CHEWING_API const char *chewing_bopomofo_String_static(const ChewingContext *ctx);
|
||||
CHEWING_API int chewing_bopomofo_Check(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
CHEWING_API int chewing_cursor_Current(const ChewingContext *ctx);
|
||||
|
||||
/*@{*/
|
||||
CHEWING_API int chewing_cand_CheckDone(const ChewingContext *ctx);
|
||||
CHEWING_API int chewing_cand_TotalPage(const ChewingContext *ctx);
|
||||
CHEWING_API int chewing_cand_ChoicePerPage(const ChewingContext *ctx);
|
||||
CHEWING_API int chewing_cand_TotalChoice(const ChewingContext *ctx);
|
||||
CHEWING_API int chewing_cand_CurrentPage(const ChewingContext *ctx);
|
||||
CHEWING_API void chewing_cand_Enumerate(ChewingContext *ctx);
|
||||
CHEWING_API int chewing_cand_hasNext(ChewingContext *ctx);
|
||||
CHEWING_API char *chewing_cand_String(ChewingContext *ctx);
|
||||
CHEWING_API const char *chewing_cand_String_static(ChewingContext *ctx);
|
||||
CHEWING_API char *chewing_cand_string_by_index(ChewingContext *ctx, int index);
|
||||
CHEWING_API const char *chewing_cand_string_by_index_static(ChewingContext *ctx, int index);
|
||||
CHEWING_API int chewing_cand_choose_by_index(ChewingContext *ctx, int index);
|
||||
CHEWING_API int chewing_cand_open(ChewingContext *ctx);
|
||||
CHEWING_API int chewing_cand_close(ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*@{*/
|
||||
CHEWING_API void chewing_interval_Enumerate(ChewingContext *ctx);
|
||||
CHEWING_API int chewing_interval_hasNext(ChewingContext *ctx);
|
||||
CHEWING_API void chewing_interval_Get(ChewingContext *ctx, IntervalType * it);
|
||||
|
||||
/*@}*/
|
||||
|
||||
/*@{*/
|
||||
CHEWING_API int chewing_aux_Check(const ChewingContext *ctx);
|
||||
CHEWING_API int chewing_aux_Length(const ChewingContext *ctx);
|
||||
CHEWING_API char *chewing_aux_String(const ChewingContext *ctx);
|
||||
CHEWING_API const char *chewing_aux_String_static(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*@{*/
|
||||
CHEWING_API int chewing_keystroke_CheckIgnore(const ChewingContext *ctx);
|
||||
CHEWING_API int chewing_keystroke_CheckAbsorb(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*@{*/
|
||||
CHEWING_API int chewing_kbtype_Total(const ChewingContext *ctx);
|
||||
CHEWING_API void chewing_kbtype_Enumerate(ChewingContext *ctx);
|
||||
CHEWING_API int chewing_kbtype_hasNext(ChewingContext *ctx);
|
||||
CHEWING_API char *chewing_kbtype_String(ChewingContext *ctx);
|
||||
CHEWING_API const char *chewing_kbtype_String_static(ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
#endif /* CHEWING_MOD_AUX_H */
|
||||
/* *INDENT-ON* */
|
||||
#include "chewing.h"
|
||||
28
libchewing/armeabi-v7a/lib/cmake/Chewing/ChewingConfig.cmake
Normal file
28
libchewing/armeabi-v7a/lib/cmake/Chewing/ChewingConfig.cmake
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
|
||||
####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() #######
|
||||
####### Any changes to this file will be overwritten by the next CMake run ####
|
||||
####### The input file was ChewingConfig.cmake.in ########
|
||||
|
||||
get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE)
|
||||
|
||||
macro(set_and_check _var _file)
|
||||
set(${_var} "${_file}")
|
||||
if(NOT EXISTS "${_file}")
|
||||
message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(check_required_components _NAME)
|
||||
foreach(comp ${${_NAME}_FIND_COMPONENTS})
|
||||
if(NOT ${_NAME}_${comp}_FOUND)
|
||||
if(${_NAME}_FIND_REQUIRED_${comp})
|
||||
set(${_NAME}_FOUND FALSE)
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
####################################################################################
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/ChewingTargets.cmake")
|
||||
check_required_components(Chewing)
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
# This is a basic version file for the Config-mode of find_package().
|
||||
# It is used by write_basic_package_version_file() as input file for configure_file()
|
||||
# to create a version-file which can be installed along a config.cmake file.
|
||||
#
|
||||
# The created file sets PACKAGE_VERSION_EXACT if the current version string and
|
||||
# the requested version string are exactly the same and it sets
|
||||
# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version,
|
||||
# but only if the requested major version is the same as the current one.
|
||||
# The variable CVF_VERSION must be set before calling configure_file().
|
||||
|
||||
|
||||
set(PACKAGE_VERSION "a6a8fa4-dirty")
|
||||
|
||||
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
else()
|
||||
|
||||
if("a6a8fa4-dirty" MATCHES "^([0-9]+)\\.")
|
||||
set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}")
|
||||
if(NOT CVF_VERSION_MAJOR VERSION_EQUAL 0)
|
||||
string(REGEX REPLACE "^0+" "" CVF_VERSION_MAJOR "${CVF_VERSION_MAJOR}")
|
||||
endif()
|
||||
else()
|
||||
set(CVF_VERSION_MAJOR "a6a8fa4-dirty")
|
||||
endif()
|
||||
|
||||
if(PACKAGE_FIND_VERSION_RANGE)
|
||||
# both endpoints of the range must have the expected major version
|
||||
math (EXPR CVF_VERSION_MAJOR_NEXT "${CVF_VERSION_MAJOR} + 1")
|
||||
if (NOT PACKAGE_FIND_VERSION_MIN_MAJOR STREQUAL CVF_VERSION_MAJOR
|
||||
OR ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND NOT PACKAGE_FIND_VERSION_MAX_MAJOR STREQUAL CVF_VERSION_MAJOR)
|
||||
OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND NOT PACKAGE_FIND_VERSION_MAX VERSION_LESS_EQUAL CVF_VERSION_MAJOR_NEXT)))
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
elseif(PACKAGE_FIND_VERSION_MIN_MAJOR STREQUAL CVF_VERSION_MAJOR
|
||||
AND ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_LESS_EQUAL PACKAGE_FIND_VERSION_MAX)
|
||||
OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION_MAX)))
|
||||
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||
else()
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
endif()
|
||||
else()
|
||||
if(PACKAGE_FIND_VERSION_MAJOR STREQUAL CVF_VERSION_MAJOR)
|
||||
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||
else()
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
endif()
|
||||
|
||||
if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
|
||||
set(PACKAGE_VERSION_EXACT TRUE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
|
||||
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "4" STREQUAL "")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
|
||||
if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "4")
|
||||
math(EXPR installedBits "4 * 8")
|
||||
set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
|
||||
set(PACKAGE_VERSION_UNSUITABLE TRUE)
|
||||
endif()
|
||||
107
libchewing/armeabi-v7a/lib/cmake/Chewing/ChewingTargets.cmake
Normal file
107
libchewing/armeabi-v7a/lib/cmake/Chewing/ChewingTargets.cmake
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
# Generated by CMake
|
||||
|
||||
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.8)
|
||||
message(FATAL_ERROR "CMake >= 3.0.0 required")
|
||||
endif()
|
||||
if(CMAKE_VERSION VERSION_LESS "3.0.0")
|
||||
message(FATAL_ERROR "CMake >= 3.0.0 required")
|
||||
endif()
|
||||
cmake_policy(PUSH)
|
||||
cmake_policy(VERSION 3.0.0...3.29)
|
||||
#----------------------------------------------------------------
|
||||
# Generated CMake target import file.
|
||||
#----------------------------------------------------------------
|
||||
|
||||
# Commands may need to know the format version.
|
||||
set(CMAKE_IMPORT_FILE_VERSION 1)
|
||||
|
||||
# Protect against multiple inclusion, which would fail when already imported targets are added once more.
|
||||
set(_cmake_targets_defined "")
|
||||
set(_cmake_targets_not_defined "")
|
||||
set(_cmake_expected_targets "")
|
||||
foreach(_cmake_expected_target IN ITEMS Chewing::chewing_capi)
|
||||
list(APPEND _cmake_expected_targets "${_cmake_expected_target}")
|
||||
if(TARGET "${_cmake_expected_target}")
|
||||
list(APPEND _cmake_targets_defined "${_cmake_expected_target}")
|
||||
else()
|
||||
list(APPEND _cmake_targets_not_defined "${_cmake_expected_target}")
|
||||
endif()
|
||||
endforeach()
|
||||
unset(_cmake_expected_target)
|
||||
if(_cmake_targets_defined STREQUAL _cmake_expected_targets)
|
||||
unset(_cmake_targets_defined)
|
||||
unset(_cmake_targets_not_defined)
|
||||
unset(_cmake_expected_targets)
|
||||
unset(CMAKE_IMPORT_FILE_VERSION)
|
||||
cmake_policy(POP)
|
||||
return()
|
||||
endif()
|
||||
if(NOT _cmake_targets_defined STREQUAL "")
|
||||
string(REPLACE ";" ", " _cmake_targets_defined_text "${_cmake_targets_defined}")
|
||||
string(REPLACE ";" ", " _cmake_targets_not_defined_text "${_cmake_targets_not_defined}")
|
||||
message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_cmake_targets_defined_text}\nTargets not yet defined: ${_cmake_targets_not_defined_text}\n")
|
||||
endif()
|
||||
unset(_cmake_targets_defined)
|
||||
unset(_cmake_targets_not_defined)
|
||||
unset(_cmake_expected_targets)
|
||||
|
||||
|
||||
# Compute the installation prefix relative to this file.
|
||||
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
|
||||
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
|
||||
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
|
||||
if(_IMPORT_PREFIX STREQUAL "/")
|
||||
set(_IMPORT_PREFIX "")
|
||||
endif()
|
||||
|
||||
# Create imported target Chewing::chewing_capi
|
||||
add_library(Chewing::chewing_capi INTERFACE IMPORTED)
|
||||
|
||||
set_target_properties(Chewing::chewing_capi PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
|
||||
INTERFACE_LINK_LIBRARIES "chewing_capi-static"
|
||||
)
|
||||
|
||||
# Load information for each installed configuration.
|
||||
file(GLOB _cmake_config_files "${CMAKE_CURRENT_LIST_DIR}/ChewingTargets-*.cmake")
|
||||
foreach(_cmake_config_file IN LISTS _cmake_config_files)
|
||||
include("${_cmake_config_file}")
|
||||
endforeach()
|
||||
unset(_cmake_config_file)
|
||||
unset(_cmake_config_files)
|
||||
|
||||
# Cleanup temporary variables.
|
||||
set(_IMPORT_PREFIX)
|
||||
|
||||
# Loop over all imported files and verify that they actually exist
|
||||
foreach(_cmake_target IN LISTS _cmake_import_check_targets)
|
||||
if(CMAKE_VERSION VERSION_LESS "3.28"
|
||||
OR NOT DEFINED _cmake_import_check_xcframework_for_${_cmake_target}
|
||||
OR NOT IS_DIRECTORY "${_cmake_import_check_xcframework_for_${_cmake_target}}")
|
||||
foreach(_cmake_file IN LISTS "_cmake_import_check_files_for_${_cmake_target}")
|
||||
if(NOT EXISTS "${_cmake_file}")
|
||||
message(FATAL_ERROR "The imported target \"${_cmake_target}\" references the file
|
||||
\"${_cmake_file}\"
|
||||
but this file does not exist. Possible reasons include:
|
||||
* The file was deleted, renamed, or moved to another location.
|
||||
* An install or uninstall procedure did not complete successfully.
|
||||
* The installation package was faulty and contained
|
||||
\"${CMAKE_CURRENT_LIST_FILE}\"
|
||||
but not all the files it references.
|
||||
")
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
unset(_cmake_file)
|
||||
unset("_cmake_import_check_files_for_${_cmake_target}")
|
||||
endforeach()
|
||||
unset(_cmake_target)
|
||||
unset(_cmake_import_check_targets)
|
||||
|
||||
# This file does not depend on other imported targets which have
|
||||
# been exported from the same project but in a separate export set.
|
||||
|
||||
# Commands beyond this point should not need to know the version.
|
||||
set(CMAKE_IMPORT_FILE_VERSION)
|
||||
cmake_policy(POP)
|
||||
Binary file not shown.
BIN
libchewing/armeabi-v7a/lib/libchewing_capi.a
Normal file
BIN
libchewing/armeabi-v7a/lib/libchewing_capi.a
Normal file
Binary file not shown.
|
|
@ -1,39 +1,3 @@
|
|||
/*
|
||||
* chewing-compat.h
|
||||
*
|
||||
* Copyright (c) 2014
|
||||
* libchewing Core Team. See ChangeLog for details.
|
||||
*
|
||||
* See the file "COPYING" for information on usage and redistribution
|
||||
* of this file.
|
||||
*/
|
||||
#warning "This header is deprecated. Include <chewing.h> directly."
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
#ifndef _CHEWING_COMPAT_
|
||||
#define _CHEWING_COMPAT_
|
||||
/* *INDENT-ON* */
|
||||
|
||||
/** @brief indicate the internal encoding of data processing.
|
||||
* @since 0.3.0
|
||||
*/
|
||||
#define LIBCHEWING_ENCODING "UTF-8"
|
||||
|
||||
/* deprecated function. for API compatibility */
|
||||
CHEWING_API int chewing_zuin_Check(const ChewingContext *ctx)
|
||||
DEPRECATED_FOR(chewing_bopomofo_Check);
|
||||
CHEWING_API char *chewing_zuin_String(const ChewingContext *, int *zuin_count)
|
||||
DEPRECATED_FOR(chewing_bopomofo_String_static);
|
||||
|
||||
CHEWING_API int chewing_Init(const char *dataPath, const char *hashPath)
|
||||
DEPRECATED;
|
||||
CHEWING_API void chewing_Terminate() DEPRECATED;
|
||||
CHEWING_API int chewing_Configure(ChewingContext *ctx, ChewingConfigData * pcd)
|
||||
DEPRECATED_FOR(chewing_set_*);
|
||||
CHEWING_API void chewing_set_hsuSelKeyType(ChewingContext *ctx, int mode)
|
||||
DEPRECATED_FOR(chewing_set_selKey);
|
||||
CHEWING_API int chewing_get_hsuSelKeyType(ChewingContext *ctx)
|
||||
DEPRECATED_FOR(chewing_get_selKey);
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
#endif
|
||||
/* *INDENT-ON* */
|
||||
#include "chewing.h"
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,587 +1,3 @@
|
|||
/*
|
||||
* chewingio.h
|
||||
*
|
||||
* Copyright (c) 1999, 2000, 2001
|
||||
* Lu-chuan Kung and Kang-pen Chen.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Copyright (c) 2004, 2005, 2008
|
||||
* libchewing Core Team. See ChangeLog for details.
|
||||
*
|
||||
* See the file "COPYING" for information on usage and redistribution
|
||||
* of this file.
|
||||
*/
|
||||
#warning "This header is deprecated. Include <chewing.h> directly."
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
#ifndef _CHEWING_IO_H
|
||||
#define _CHEWING_IO_H
|
||||
/* *INDENT-ON* */
|
||||
|
||||
/*! \file chewingio.h
|
||||
* \brief Chewing I/O module
|
||||
* \author libchewing Core Team
|
||||
*/
|
||||
|
||||
#ifdef WITH_RUST
|
||||
# include "chewing_rs.h"
|
||||
#else
|
||||
# include "global.h"
|
||||
#endif
|
||||
|
||||
#define KEYSTROKE_IGNORE 1
|
||||
#define KEYSTROKE_COMMIT 2
|
||||
#define KEYSTROKE_BELL 4
|
||||
#define KEYSTROKE_ABSORB 8
|
||||
|
||||
/*! \name Series of functions handling key stroke.
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Handle the input key stroke: Space
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Space(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Escape
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Esc(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Enter/Return
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Enter(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Delete
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Del(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Backspace
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Backspace(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Tab
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Tab(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Shift + Left
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_ShiftLeft(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Left
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Left(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Shift + Right
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_ShiftRight(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Right
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Right(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Up
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Up(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Home
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Home(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: End
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
|
||||
CHEWING_API int chewing_handle_End(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: PageUp
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_PageUp(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: PageDown
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_PageDown(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Down
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Down(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Capslock
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Capslock(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: casual key
|
||||
* @param ctx Chewing IM context
|
||||
* @param key scan code of key stroke
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Default(ChewingContext *ctx, int key);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Ctrl + Number-key
|
||||
* @param ctx Chewing IM context
|
||||
* @param key scan code of number key
|
||||
*/
|
||||
CHEWING_API int chewing_handle_CtrlNum(ChewingContext *ctx, int key);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Shift + Space
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_ShiftSpace(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: double Tab
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_DblTab(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Numlock (keypad)
|
||||
* @param ctx Chewing IM context
|
||||
* @param key scan code of number key
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Numlock(ChewingContext *ctx, int key);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Chewing IM Instance Management
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Create new handle of the instance for Chewing IM
|
||||
* @see chewing_delete()
|
||||
*/
|
||||
CHEWING_API ChewingContext *chewing_new();
|
||||
|
||||
/**
|
||||
* @brief Release the handle and internal memory by given Chewing instance
|
||||
* @see chewing_new()
|
||||
*
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API void chewing_delete(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Release memory allocated used by given pointer used in APIs
|
||||
*/
|
||||
CHEWING_API void chewing_free(void *);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Chewing IM Setup
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Reset all settings
|
||||
*
|
||||
* @param ctx
|
||||
* @return If successed than return 0
|
||||
*/
|
||||
CHEWING_API int chewing_Reset(ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
/*! \name Keyboard mapping
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set keyboard mapping type
|
||||
*
|
||||
* @param ctx
|
||||
* @param kbtype index number of keyboard mapping type from KBStr2Num
|
||||
* @return If successed then return 0
|
||||
*/
|
||||
CHEWING_API int chewing_set_KBType(ChewingContext *ctx, int kbtype);
|
||||
|
||||
/**
|
||||
* @brief Get keyboard mapping type
|
||||
*
|
||||
* @param ctx
|
||||
* @return If successed then return keyboard mapping type from KBStr2Num
|
||||
*/
|
||||
CHEWING_API int chewing_get_KBType(const ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Get keyboard mapping type in C-style string format
|
||||
* @see KBStr2Num()
|
||||
*
|
||||
* @param ctx
|
||||
* @return The name of the current keyboard layout. The caller must free it.
|
||||
*/
|
||||
CHEWING_API char *chewing_get_KBString(const ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Get the index number of keyboard mapping type from given string
|
||||
*
|
||||
* @param str[] name of kbtype eg. "KB_HSU"
|
||||
*/
|
||||
CHEWING_API int chewing_KBStr2Num(const char str[]);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Operating language mode of Chewing IM
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set the operating language mode of Chewing IM.
|
||||
*
|
||||
* @param ctx
|
||||
* @param mode CHINESE_MODE or ENGLISH_MODE
|
||||
*/
|
||||
CHEWING_API void chewing_set_ChiEngMode(ChewingContext *ctx, int mode);
|
||||
|
||||
/**
|
||||
* @brief Get current operating language mode: English / Chinese
|
||||
*
|
||||
* @param ctx
|
||||
*
|
||||
* @return CHINESE_MODE or ENGLISH_MODE
|
||||
*/
|
||||
CHEWING_API int chewing_get_ChiEngMode(const ChewingContext *ctx);
|
||||
|
||||
/*@*/
|
||||
|
||||
|
||||
/*! \name Shape mode of output symbols
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set the shape mode of output symbols: full-shape / half-shape
|
||||
*
|
||||
* @param ctx
|
||||
* @param mode FULLSHAPE_MODE or HALFSHAPE_MODE
|
||||
*/
|
||||
CHEWING_API void chewing_set_ShapeMode(ChewingContext *ctx, int mode);
|
||||
|
||||
/**
|
||||
* @brief Get current shape mode of output symbols
|
||||
*
|
||||
* @param ctx
|
||||
*
|
||||
* @return FULLSHAPE_MODE or HALFSHAPE_MODE
|
||||
*/
|
||||
CHEWING_API int chewing_get_ShapeMode(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Number of selection candidate per page
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set the number of selection candidate per page
|
||||
*
|
||||
* @param ctx
|
||||
* @param n number of selection candidate
|
||||
*/
|
||||
CHEWING_API void chewing_set_candPerPage(ChewingContext *ctx, int n);
|
||||
|
||||
/**
|
||||
* @brief Get the number of selection candidate per page
|
||||
*
|
||||
* @param ctx
|
||||
*/
|
||||
CHEWING_API int chewing_get_candPerPage(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Maximum length of Chinese symbols
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set the maximum length of Chinese symbols
|
||||
*
|
||||
* @param ctx
|
||||
* @param n maximum length
|
||||
*/
|
||||
CHEWING_API void chewing_set_maxChiSymbolLen(ChewingContext *ctx, int n);
|
||||
|
||||
/**
|
||||
* @brief Get the maximum length of Chinese symbols
|
||||
*
|
||||
* @param ctx
|
||||
*/
|
||||
CHEWING_API int chewing_get_maxChiSymbolLen(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Key sequence for selecting phrases
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set the key sequence for selecting phrases
|
||||
*
|
||||
* @param ctx
|
||||
* @param selkeys
|
||||
* @param len
|
||||
*/
|
||||
CHEWING_API void chewing_set_selKey(ChewingContext *ctx, const int *selkeys, int len);
|
||||
|
||||
/**
|
||||
* @brief Get the key sequence for selecting phrases
|
||||
*
|
||||
* @param ctx
|
||||
*/
|
||||
CHEWING_API int *chewing_get_selKey(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Direction of adding new user-defined phrases
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set the direction of adding new user-defined phrases
|
||||
*
|
||||
* @param ctx
|
||||
* @param direction
|
||||
*/
|
||||
CHEWING_API void chewing_set_addPhraseDirection(ChewingContext *ctx, int direction);
|
||||
|
||||
/**
|
||||
* @brief Get the direction of adding new user-defined phrases
|
||||
*
|
||||
* @param ctx
|
||||
*/
|
||||
CHEWING_API int chewing_get_addPhraseDirection(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Behavior whether if space key is regarded as selection key
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set the behavior whether if space key is regarded as selection key
|
||||
*
|
||||
* @param ctx
|
||||
* @param mode
|
||||
*/
|
||||
CHEWING_API void chewing_set_spaceAsSelection(ChewingContext *ctx, int mode);
|
||||
|
||||
/**
|
||||
* @brief Get the behavior if space key is regarded as selection key or not
|
||||
*
|
||||
* @param ctx
|
||||
*/
|
||||
CHEWING_API int chewing_get_spaceAsSelection(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Behavior whether if Escape should clean all buffer
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set the behavior whether if Escape key should clean all buffer
|
||||
*
|
||||
* @param ctx
|
||||
* @param mode
|
||||
*/
|
||||
CHEWING_API void chewing_set_escCleanAllBuf(ChewingContext *ctx, int mode);
|
||||
|
||||
/**
|
||||
* @brief Get the behavior whether if Escape key should clean all buffer
|
||||
*
|
||||
* @param ctx
|
||||
*/
|
||||
CHEWING_API int chewing_get_escCleanAllBuf(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Behavior of automatically shifting cursor after selection
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set the behavior of automatically shifting cursor after selection
|
||||
*
|
||||
* @param ctx
|
||||
* @param mode
|
||||
*/
|
||||
CHEWING_API void chewing_set_autoShiftCur(ChewingContext *ctx, int mode);
|
||||
|
||||
/**
|
||||
* @brief Get the behavior of automatically shifting cursor after selection
|
||||
*
|
||||
* @param ctx
|
||||
*/
|
||||
CHEWING_API int chewing_get_autoShiftCur(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Operating mode during easy symbol input
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set the operating mode during easy symbol input
|
||||
*
|
||||
* @param ctx
|
||||
* @param mode
|
||||
*/
|
||||
CHEWING_API void chewing_set_easySymbolInput(ChewingContext *ctx, int mode);
|
||||
|
||||
/**
|
||||
* @brief Get the operating mode during easy symbol input
|
||||
*
|
||||
* @param ctx
|
||||
*/
|
||||
CHEWING_API int chewing_get_easySymbolInput(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Behavior for phrase choice to be rearward or not
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set the behavior for phrase choice to be rearward or not
|
||||
*
|
||||
* @param ctx
|
||||
* @param mode
|
||||
*/
|
||||
CHEWING_API void chewing_set_phraseChoiceRearward(ChewingContext *ctx, int mode);
|
||||
|
||||
/**
|
||||
* @brief Get the behavior for phrase choice to be rearward or not
|
||||
*
|
||||
* @param ctx
|
||||
*/
|
||||
CHEWING_API int chewing_get_phraseChoiceRearward(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Behavior of automatic learning after committing
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set the behavior of automatic learning
|
||||
*
|
||||
* @param ctx
|
||||
* @param mode AUTOLEARN_ENABLED or AUTOLEARN_DISABLED
|
||||
*/
|
||||
CHEWING_API void chewing_set_autoLearn(ChewingContext *ctx, int mode);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get the behavior of automatic learning
|
||||
*
|
||||
* @param ctx
|
||||
* @return AUTOLEARN_ENABLED or AUTOLEARN_DISABLED
|
||||
*/
|
||||
CHEWING_API int chewing_get_autoLearn(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Phonetic sequence in Chewing internal state machine
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Get phonetic sequence in Chewing internal state machine
|
||||
*
|
||||
* @param ctx
|
||||
*/
|
||||
CHEWING_API unsigned short *chewing_get_phoneSeq(const ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Get the length of phonetic sequence in Chewing internal state machine
|
||||
*
|
||||
* @param ctx
|
||||
*/
|
||||
CHEWING_API int chewing_get_phoneSeqLen(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
CHEWING_API void chewing_set_logger(ChewingContext *ctx,
|
||||
void (*logger) (void *data, int level, const char *fmt, ...), void *data);
|
||||
|
||||
CHEWING_API int chewing_userphrase_enumerate(ChewingContext *ctx);
|
||||
|
||||
CHEWING_API int chewing_userphrase_has_next(ChewingContext *ctx, unsigned int *phrase_len, unsigned int *bopomofo_len);
|
||||
|
||||
CHEWING_API int chewing_userphrase_get(ChewingContext *ctx,
|
||||
char *phrase_buf, unsigned int phrase_len,
|
||||
char *bopomofo_buf, unsigned int bopomofo_len);
|
||||
|
||||
CHEWING_API int chewing_userphrase_add(ChewingContext *ctx, const char *phrase_buf, const char *bopomofo_buf);
|
||||
|
||||
CHEWING_API int chewing_userphrase_remove(ChewingContext *ctx, const char *phrase_buf, const char *bopomofo_buf);
|
||||
|
||||
CHEWING_API int chewing_userphrase_lookup(ChewingContext *ctx, const char *phrase_buf, const char *bopomofo_buf);
|
||||
|
||||
CHEWING_API int chewing_cand_list_first(ChewingContext *ctx);
|
||||
CHEWING_API int chewing_cand_list_last(ChewingContext *ctx);
|
||||
CHEWING_API int chewing_cand_list_has_next(ChewingContext *ctx);
|
||||
CHEWING_API int chewing_cand_list_has_prev(ChewingContext *ctx);
|
||||
CHEWING_API int chewing_cand_list_next(ChewingContext *ctx);
|
||||
CHEWING_API int chewing_cand_list_prev(ChewingContext *ctx);
|
||||
|
||||
CHEWING_API int chewing_commit_preedit_buf(ChewingContext *ctx);
|
||||
CHEWING_API int chewing_clean_preedit_buf(ChewingContext *ctx);
|
||||
|
||||
CHEWING_API int chewing_clean_bopomofo_buf(ChewingContext *ctx);
|
||||
|
||||
CHEWING_API ChewingContext *chewing_new2(const char *syspath,
|
||||
const char *userpath,
|
||||
void (*logger) (void *data, int level, const char *fmt, ...),
|
||||
void *loggerdata);
|
||||
|
||||
CHEWING_API int chewing_phone_to_bopomofo(unsigned short phone, char *buf, unsigned short len);
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
#endif /* _CHEWING_IO_H */
|
||||
/* *INDENT-ON* */
|
||||
#include "chewing.h"
|
||||
|
|
@ -1,124 +1,3 @@
|
|||
/*
|
||||
* global.h
|
||||
*
|
||||
* Copyright (c) 1999, 2000, 2001
|
||||
* Lu-chuan Kung and Kang-pen Chen.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Copyright (c) 2004, 2005, 2006, 2008, 2011
|
||||
* libchewing Core Team. See ChangeLog for details.
|
||||
*
|
||||
* See the file "COPYING" for information on usage and redistribution
|
||||
* of this file.
|
||||
*/
|
||||
#warning "This header is deprecated. Include <chewing.h> directly."
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
#ifndef _CHEWING_GLOBAL_H
|
||||
#define _CHEWING_GLOBAL_H
|
||||
/* *INDENT-ON* */
|
||||
|
||||
/*! \file global.h
|
||||
* \brief Chewing Global Definitions
|
||||
* \author libchewing Core Team
|
||||
*/
|
||||
|
||||
#define CHINESE_MODE 1
|
||||
#define SYMBOL_MODE 0
|
||||
#define FULLSHAPE_MODE 1
|
||||
#define HALFSHAPE_MODE 0
|
||||
#define AUTOLEARN_DISABLED 1
|
||||
#define AUTOLEARN_ENABLED 0
|
||||
|
||||
/* specified to Chewing API */
|
||||
#if defined(_WIN32) || defined(_WIN64) || defined(_WIN32_WCE)
|
||||
# define CHEWING_DLL_IMPORT __declspec(dllimport)
|
||||
# define CHEWING_DLL_EXPORT __declspec(dllexport)
|
||||
# ifdef CHEWINGDLL_EXPORTS
|
||||
# define CHEWING_API CHEWING_DLL_EXPORT
|
||||
# define CHEWING_PRIVATE
|
||||
# elif CHEWINGDLL_IMPORTS
|
||||
# define CHEWING_API CHEWING_DLL_IMPORT
|
||||
# define CHEWING_PRIVATE
|
||||
# else
|
||||
# define CHEWING_API
|
||||
# define CHEWING_PRIVATE
|
||||
# endif
|
||||
#elif (__GNUC__ > 3) && (defined(__ELF__) || defined(__PIC__))
|
||||
# define CHEWING_API __attribute__((__visibility__("default")))
|
||||
# define CHEWING_PRIVATE __attribute__((__visibility__("hidden")))
|
||||
#else
|
||||
# define CHEWING_API
|
||||
# define CHEWING_PRIVATE
|
||||
#endif
|
||||
|
||||
#ifndef UNUSED
|
||||
# if defined(__GNUC__) /* gcc specific */
|
||||
# define UNUSED __attribute__((unused))
|
||||
# else
|
||||
# define UNUSED
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef DEPRECATED
|
||||
# if defined(__GNUC__) && __GNUC__ > 3 || \
|
||||
(__GNUC__ == 3 && __GNUC_MINOR__ >= 1) /* gcc specific */
|
||||
# define DEPRECATED __attribute__((deprecated))
|
||||
# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
|
||||
# define DEPRECATED_FOR(f) \
|
||||
__attribute__((deprecated("Use " #f " instead")))
|
||||
# else
|
||||
# define DEPRECATED_FOR(f) DEPRECATED
|
||||
# endif
|
||||
# else
|
||||
# define DEPRECATED
|
||||
# define DEPRECATED_FOR(f)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define MIN_SELKEY 1
|
||||
#define MAX_SELKEY 10
|
||||
|
||||
#define CHEWING_LOG_VERBOSE 1
|
||||
#define CHEWING_LOG_DEBUG 2
|
||||
#define CHEWING_LOG_INFO 3
|
||||
#define CHEWING_LOG_WARN 4
|
||||
#define CHEWING_LOG_ERROR 5
|
||||
|
||||
/**
|
||||
* @deprecated Use chewing_set_ series of functions to set parameters instead.
|
||||
*/
|
||||
typedef struct ChewingConfigData {
|
||||
int candPerPage;
|
||||
int maxChiSymbolLen;
|
||||
int selKey[MAX_SELKEY];
|
||||
int bAddPhraseForward;
|
||||
int bSpaceAsSelection;
|
||||
int bEscCleanAllBuf;
|
||||
int bAutoShiftCur;
|
||||
int bEasySymbolInput;
|
||||
int bPhraseChoiceRearward;
|
||||
int hsuSelKeyType; // Deprecated.
|
||||
} ChewingConfigData;
|
||||
|
||||
typedef struct IntervalType {
|
||||
/*@{ */
|
||||
int from; /**< starting position of certain interval */
|
||||
int to; /**< ending position of certain interval */
|
||||
/*@} */
|
||||
} IntervalType;
|
||||
|
||||
/** @brief context handle used for Chewing IM APIs
|
||||
*/
|
||||
typedef struct ChewingContext ChewingContext;
|
||||
|
||||
/** @brief use "asdfjkl789" as selection key
|
||||
*/
|
||||
#define HSU_SELKEY_TYPE1 1
|
||||
|
||||
/** @brief use "asdfzxcv89" as selection key
|
||||
*/
|
||||
#define HSU_SELKEY_TYPE2 2
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
#endif
|
||||
/* *INDENT-ON* */
|
||||
#include "chewing.h"
|
||||
|
|
@ -1,117 +1,3 @@
|
|||
/*
|
||||
* mod_aux.h
|
||||
*
|
||||
* Copyright (c) 2005, 2008
|
||||
* libchewing Core Team. See ChangeLog for details.
|
||||
*
|
||||
* See the file "COPYING" for information on usage and redistribution
|
||||
* of this file.
|
||||
*/
|
||||
#warning "This header is deprecated. Include <chewing.h> directly."
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
#ifndef CHEWING_MOD_AUX_H
|
||||
#define CHEWING_MOD_AUX_H
|
||||
/* *INDENT-ON* */
|
||||
|
||||
/*! \file mod_aux.h
|
||||
* \brief Auxiliary module
|
||||
* \author libchewing Core Team
|
||||
*/
|
||||
|
||||
#ifdef WITH_RUST
|
||||
# include "chewing_rs.h"
|
||||
#else
|
||||
# include "global.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Chewing the state for input context during commit process
|
||||
* @param ctx handle to Chewing IM context
|
||||
* @retval TRUE if its currnet input state is at the "end-of-a-char"
|
||||
*/
|
||||
CHEWING_API int chewing_commit_Check(const ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Get current commit string regardless of current input state
|
||||
* @param ctx handle to Chewing IM context
|
||||
*
|
||||
* Always returns a char pointer, caller must free it.
|
||||
*/
|
||||
CHEWING_API char *chewing_commit_String(const ChewingContext *ctx);
|
||||
CHEWING_API const char *chewing_commit_String_static(const ChewingContext *ctx);
|
||||
|
||||
|
||||
/*! \name Preedit string buffer
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
CHEWING_API char *chewing_buffer_String(const ChewingContext *ctx);
|
||||
CHEWING_API const char *chewing_buffer_String_static(const ChewingContext *ctx);
|
||||
CHEWING_API int chewing_buffer_Check(const ChewingContext *ctx);
|
||||
CHEWING_API int chewing_buffer_Len(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*@{*/
|
||||
CHEWING_API const char *chewing_bopomofo_String_static(const ChewingContext *ctx);
|
||||
CHEWING_API int chewing_bopomofo_Check(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
CHEWING_API int chewing_cursor_Current(const ChewingContext *ctx);
|
||||
|
||||
/*@{*/
|
||||
CHEWING_API int chewing_cand_CheckDone(const ChewingContext *ctx);
|
||||
CHEWING_API int chewing_cand_TotalPage(const ChewingContext *ctx);
|
||||
CHEWING_API int chewing_cand_ChoicePerPage(const ChewingContext *ctx);
|
||||
CHEWING_API int chewing_cand_TotalChoice(const ChewingContext *ctx);
|
||||
CHEWING_API int chewing_cand_CurrentPage(const ChewingContext *ctx);
|
||||
CHEWING_API void chewing_cand_Enumerate(ChewingContext *ctx);
|
||||
CHEWING_API int chewing_cand_hasNext(ChewingContext *ctx);
|
||||
CHEWING_API char *chewing_cand_String(ChewingContext *ctx);
|
||||
CHEWING_API const char *chewing_cand_String_static(ChewingContext *ctx);
|
||||
CHEWING_API char *chewing_cand_string_by_index(ChewingContext *ctx, int index);
|
||||
CHEWING_API const char *chewing_cand_string_by_index_static(ChewingContext *ctx, int index);
|
||||
CHEWING_API int chewing_cand_choose_by_index(ChewingContext *ctx, int index);
|
||||
CHEWING_API int chewing_cand_open(ChewingContext *ctx);
|
||||
CHEWING_API int chewing_cand_close(ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*@{*/
|
||||
CHEWING_API void chewing_interval_Enumerate(ChewingContext *ctx);
|
||||
CHEWING_API int chewing_interval_hasNext(ChewingContext *ctx);
|
||||
CHEWING_API void chewing_interval_Get(ChewingContext *ctx, IntervalType * it);
|
||||
|
||||
/*@}*/
|
||||
|
||||
/*@{*/
|
||||
CHEWING_API int chewing_aux_Check(const ChewingContext *ctx);
|
||||
CHEWING_API int chewing_aux_Length(const ChewingContext *ctx);
|
||||
CHEWING_API char *chewing_aux_String(const ChewingContext *ctx);
|
||||
CHEWING_API const char *chewing_aux_String_static(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*@{*/
|
||||
CHEWING_API int chewing_keystroke_CheckIgnore(const ChewingContext *ctx);
|
||||
CHEWING_API int chewing_keystroke_CheckAbsorb(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*@{*/
|
||||
CHEWING_API int chewing_kbtype_Total(const ChewingContext *ctx);
|
||||
CHEWING_API void chewing_kbtype_Enumerate(ChewingContext *ctx);
|
||||
CHEWING_API int chewing_kbtype_hasNext(ChewingContext *ctx);
|
||||
CHEWING_API char *chewing_kbtype_String(ChewingContext *ctx);
|
||||
CHEWING_API const char *chewing_kbtype_String_static(ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
#endif /* CHEWING_MOD_AUX_H */
|
||||
/* *INDENT-ON* */
|
||||
#include "chewing.h"
|
||||
28
libchewing/x86/lib/cmake/Chewing/ChewingConfig.cmake
Normal file
28
libchewing/x86/lib/cmake/Chewing/ChewingConfig.cmake
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
|
||||
####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() #######
|
||||
####### Any changes to this file will be overwritten by the next CMake run ####
|
||||
####### The input file was ChewingConfig.cmake.in ########
|
||||
|
||||
get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE)
|
||||
|
||||
macro(set_and_check _var _file)
|
||||
set(${_var} "${_file}")
|
||||
if(NOT EXISTS "${_file}")
|
||||
message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(check_required_components _NAME)
|
||||
foreach(comp ${${_NAME}_FIND_COMPONENTS})
|
||||
if(NOT ${_NAME}_${comp}_FOUND)
|
||||
if(${_NAME}_FIND_REQUIRED_${comp})
|
||||
set(${_NAME}_FOUND FALSE)
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
####################################################################################
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/ChewingTargets.cmake")
|
||||
check_required_components(Chewing)
|
||||
65
libchewing/x86/lib/cmake/Chewing/ChewingConfigVersion.cmake
Normal file
65
libchewing/x86/lib/cmake/Chewing/ChewingConfigVersion.cmake
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
# This is a basic version file for the Config-mode of find_package().
|
||||
# It is used by write_basic_package_version_file() as input file for configure_file()
|
||||
# to create a version-file which can be installed along a config.cmake file.
|
||||
#
|
||||
# The created file sets PACKAGE_VERSION_EXACT if the current version string and
|
||||
# the requested version string are exactly the same and it sets
|
||||
# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version,
|
||||
# but only if the requested major version is the same as the current one.
|
||||
# The variable CVF_VERSION must be set before calling configure_file().
|
||||
|
||||
|
||||
set(PACKAGE_VERSION "a6a8fa4-dirty")
|
||||
|
||||
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
else()
|
||||
|
||||
if("a6a8fa4-dirty" MATCHES "^([0-9]+)\\.")
|
||||
set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}")
|
||||
if(NOT CVF_VERSION_MAJOR VERSION_EQUAL 0)
|
||||
string(REGEX REPLACE "^0+" "" CVF_VERSION_MAJOR "${CVF_VERSION_MAJOR}")
|
||||
endif()
|
||||
else()
|
||||
set(CVF_VERSION_MAJOR "a6a8fa4-dirty")
|
||||
endif()
|
||||
|
||||
if(PACKAGE_FIND_VERSION_RANGE)
|
||||
# both endpoints of the range must have the expected major version
|
||||
math (EXPR CVF_VERSION_MAJOR_NEXT "${CVF_VERSION_MAJOR} + 1")
|
||||
if (NOT PACKAGE_FIND_VERSION_MIN_MAJOR STREQUAL CVF_VERSION_MAJOR
|
||||
OR ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND NOT PACKAGE_FIND_VERSION_MAX_MAJOR STREQUAL CVF_VERSION_MAJOR)
|
||||
OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND NOT PACKAGE_FIND_VERSION_MAX VERSION_LESS_EQUAL CVF_VERSION_MAJOR_NEXT)))
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
elseif(PACKAGE_FIND_VERSION_MIN_MAJOR STREQUAL CVF_VERSION_MAJOR
|
||||
AND ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_LESS_EQUAL PACKAGE_FIND_VERSION_MAX)
|
||||
OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION_MAX)))
|
||||
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||
else()
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
endif()
|
||||
else()
|
||||
if(PACKAGE_FIND_VERSION_MAJOR STREQUAL CVF_VERSION_MAJOR)
|
||||
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||
else()
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
endif()
|
||||
|
||||
if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
|
||||
set(PACKAGE_VERSION_EXACT TRUE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
|
||||
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "4" STREQUAL "")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
|
||||
if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "4")
|
||||
math(EXPR installedBits "4 * 8")
|
||||
set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
|
||||
set(PACKAGE_VERSION_UNSUITABLE TRUE)
|
||||
endif()
|
||||
107
libchewing/x86/lib/cmake/Chewing/ChewingTargets.cmake
Normal file
107
libchewing/x86/lib/cmake/Chewing/ChewingTargets.cmake
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
# Generated by CMake
|
||||
|
||||
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.8)
|
||||
message(FATAL_ERROR "CMake >= 3.0.0 required")
|
||||
endif()
|
||||
if(CMAKE_VERSION VERSION_LESS "3.0.0")
|
||||
message(FATAL_ERROR "CMake >= 3.0.0 required")
|
||||
endif()
|
||||
cmake_policy(PUSH)
|
||||
cmake_policy(VERSION 3.0.0...3.29)
|
||||
#----------------------------------------------------------------
|
||||
# Generated CMake target import file.
|
||||
#----------------------------------------------------------------
|
||||
|
||||
# Commands may need to know the format version.
|
||||
set(CMAKE_IMPORT_FILE_VERSION 1)
|
||||
|
||||
# Protect against multiple inclusion, which would fail when already imported targets are added once more.
|
||||
set(_cmake_targets_defined "")
|
||||
set(_cmake_targets_not_defined "")
|
||||
set(_cmake_expected_targets "")
|
||||
foreach(_cmake_expected_target IN ITEMS Chewing::chewing_capi)
|
||||
list(APPEND _cmake_expected_targets "${_cmake_expected_target}")
|
||||
if(TARGET "${_cmake_expected_target}")
|
||||
list(APPEND _cmake_targets_defined "${_cmake_expected_target}")
|
||||
else()
|
||||
list(APPEND _cmake_targets_not_defined "${_cmake_expected_target}")
|
||||
endif()
|
||||
endforeach()
|
||||
unset(_cmake_expected_target)
|
||||
if(_cmake_targets_defined STREQUAL _cmake_expected_targets)
|
||||
unset(_cmake_targets_defined)
|
||||
unset(_cmake_targets_not_defined)
|
||||
unset(_cmake_expected_targets)
|
||||
unset(CMAKE_IMPORT_FILE_VERSION)
|
||||
cmake_policy(POP)
|
||||
return()
|
||||
endif()
|
||||
if(NOT _cmake_targets_defined STREQUAL "")
|
||||
string(REPLACE ";" ", " _cmake_targets_defined_text "${_cmake_targets_defined}")
|
||||
string(REPLACE ";" ", " _cmake_targets_not_defined_text "${_cmake_targets_not_defined}")
|
||||
message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_cmake_targets_defined_text}\nTargets not yet defined: ${_cmake_targets_not_defined_text}\n")
|
||||
endif()
|
||||
unset(_cmake_targets_defined)
|
||||
unset(_cmake_targets_not_defined)
|
||||
unset(_cmake_expected_targets)
|
||||
|
||||
|
||||
# Compute the installation prefix relative to this file.
|
||||
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
|
||||
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
|
||||
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
|
||||
if(_IMPORT_PREFIX STREQUAL "/")
|
||||
set(_IMPORT_PREFIX "")
|
||||
endif()
|
||||
|
||||
# Create imported target Chewing::chewing_capi
|
||||
add_library(Chewing::chewing_capi INTERFACE IMPORTED)
|
||||
|
||||
set_target_properties(Chewing::chewing_capi PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
|
||||
INTERFACE_LINK_LIBRARIES "chewing_capi-static"
|
||||
)
|
||||
|
||||
# Load information for each installed configuration.
|
||||
file(GLOB _cmake_config_files "${CMAKE_CURRENT_LIST_DIR}/ChewingTargets-*.cmake")
|
||||
foreach(_cmake_config_file IN LISTS _cmake_config_files)
|
||||
include("${_cmake_config_file}")
|
||||
endforeach()
|
||||
unset(_cmake_config_file)
|
||||
unset(_cmake_config_files)
|
||||
|
||||
# Cleanup temporary variables.
|
||||
set(_IMPORT_PREFIX)
|
||||
|
||||
# Loop over all imported files and verify that they actually exist
|
||||
foreach(_cmake_target IN LISTS _cmake_import_check_targets)
|
||||
if(CMAKE_VERSION VERSION_LESS "3.28"
|
||||
OR NOT DEFINED _cmake_import_check_xcframework_for_${_cmake_target}
|
||||
OR NOT IS_DIRECTORY "${_cmake_import_check_xcframework_for_${_cmake_target}}")
|
||||
foreach(_cmake_file IN LISTS "_cmake_import_check_files_for_${_cmake_target}")
|
||||
if(NOT EXISTS "${_cmake_file}")
|
||||
message(FATAL_ERROR "The imported target \"${_cmake_target}\" references the file
|
||||
\"${_cmake_file}\"
|
||||
but this file does not exist. Possible reasons include:
|
||||
* The file was deleted, renamed, or moved to another location.
|
||||
* An install or uninstall procedure did not complete successfully.
|
||||
* The installation package was faulty and contained
|
||||
\"${CMAKE_CURRENT_LIST_FILE}\"
|
||||
but not all the files it references.
|
||||
")
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
unset(_cmake_file)
|
||||
unset("_cmake_import_check_files_for_${_cmake_target}")
|
||||
endforeach()
|
||||
unset(_cmake_target)
|
||||
unset(_cmake_import_check_targets)
|
||||
|
||||
# This file does not depend on other imported targets which have
|
||||
# been exported from the same project but in a separate export set.
|
||||
|
||||
# Commands beyond this point should not need to know the version.
|
||||
set(CMAKE_IMPORT_FILE_VERSION)
|
||||
cmake_policy(POP)
|
||||
Binary file not shown.
BIN
libchewing/x86/lib/libchewing_capi.a
Normal file
BIN
libchewing/x86/lib/libchewing_capi.a
Normal file
Binary file not shown.
|
|
@ -1,39 +1,3 @@
|
|||
/*
|
||||
* chewing-compat.h
|
||||
*
|
||||
* Copyright (c) 2014
|
||||
* libchewing Core Team. See ChangeLog for details.
|
||||
*
|
||||
* See the file "COPYING" for information on usage and redistribution
|
||||
* of this file.
|
||||
*/
|
||||
#warning "This header is deprecated. Include <chewing.h> directly."
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
#ifndef _CHEWING_COMPAT_
|
||||
#define _CHEWING_COMPAT_
|
||||
/* *INDENT-ON* */
|
||||
|
||||
/** @brief indicate the internal encoding of data processing.
|
||||
* @since 0.3.0
|
||||
*/
|
||||
#define LIBCHEWING_ENCODING "UTF-8"
|
||||
|
||||
/* deprecated function. for API compatibility */
|
||||
CHEWING_API int chewing_zuin_Check(const ChewingContext *ctx)
|
||||
DEPRECATED_FOR(chewing_bopomofo_Check);
|
||||
CHEWING_API char *chewing_zuin_String(const ChewingContext *, int *zuin_count)
|
||||
DEPRECATED_FOR(chewing_bopomofo_String_static);
|
||||
|
||||
CHEWING_API int chewing_Init(const char *dataPath, const char *hashPath)
|
||||
DEPRECATED;
|
||||
CHEWING_API void chewing_Terminate() DEPRECATED;
|
||||
CHEWING_API int chewing_Configure(ChewingContext *ctx, ChewingConfigData * pcd)
|
||||
DEPRECATED_FOR(chewing_set_*);
|
||||
CHEWING_API void chewing_set_hsuSelKeyType(ChewingContext *ctx, int mode)
|
||||
DEPRECATED_FOR(chewing_set_selKey);
|
||||
CHEWING_API int chewing_get_hsuSelKeyType(ChewingContext *ctx)
|
||||
DEPRECATED_FOR(chewing_get_selKey);
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
#endif
|
||||
/* *INDENT-ON* */
|
||||
#include "chewing.h"
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,587 +1,3 @@
|
|||
/*
|
||||
* chewingio.h
|
||||
*
|
||||
* Copyright (c) 1999, 2000, 2001
|
||||
* Lu-chuan Kung and Kang-pen Chen.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Copyright (c) 2004, 2005, 2008
|
||||
* libchewing Core Team. See ChangeLog for details.
|
||||
*
|
||||
* See the file "COPYING" for information on usage and redistribution
|
||||
* of this file.
|
||||
*/
|
||||
#warning "This header is deprecated. Include <chewing.h> directly."
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
#ifndef _CHEWING_IO_H
|
||||
#define _CHEWING_IO_H
|
||||
/* *INDENT-ON* */
|
||||
|
||||
/*! \file chewingio.h
|
||||
* \brief Chewing I/O module
|
||||
* \author libchewing Core Team
|
||||
*/
|
||||
|
||||
#ifdef WITH_RUST
|
||||
# include "chewing_rs.h"
|
||||
#else
|
||||
# include "global.h"
|
||||
#endif
|
||||
|
||||
#define KEYSTROKE_IGNORE 1
|
||||
#define KEYSTROKE_COMMIT 2
|
||||
#define KEYSTROKE_BELL 4
|
||||
#define KEYSTROKE_ABSORB 8
|
||||
|
||||
/*! \name Series of functions handling key stroke.
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Handle the input key stroke: Space
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Space(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Escape
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Esc(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Enter/Return
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Enter(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Delete
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Del(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Backspace
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Backspace(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Tab
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Tab(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Shift + Left
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_ShiftLeft(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Left
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Left(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Shift + Right
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_ShiftRight(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Right
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Right(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Up
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Up(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Home
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Home(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: End
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
|
||||
CHEWING_API int chewing_handle_End(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: PageUp
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_PageUp(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: PageDown
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_PageDown(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Down
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Down(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Capslock
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Capslock(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: casual key
|
||||
* @param ctx Chewing IM context
|
||||
* @param key scan code of key stroke
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Default(ChewingContext *ctx, int key);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Ctrl + Number-key
|
||||
* @param ctx Chewing IM context
|
||||
* @param key scan code of number key
|
||||
*/
|
||||
CHEWING_API int chewing_handle_CtrlNum(ChewingContext *ctx, int key);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Shift + Space
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_ShiftSpace(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: double Tab
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API int chewing_handle_DblTab(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Handle the input key stroke: Numlock (keypad)
|
||||
* @param ctx Chewing IM context
|
||||
* @param key scan code of number key
|
||||
*/
|
||||
CHEWING_API int chewing_handle_Numlock(ChewingContext *ctx, int key);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Chewing IM Instance Management
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Create new handle of the instance for Chewing IM
|
||||
* @see chewing_delete()
|
||||
*/
|
||||
CHEWING_API ChewingContext *chewing_new();
|
||||
|
||||
/**
|
||||
* @brief Release the handle and internal memory by given Chewing instance
|
||||
* @see chewing_new()
|
||||
*
|
||||
* @param ctx Chewing IM context
|
||||
*/
|
||||
CHEWING_API void chewing_delete(ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Release memory allocated used by given pointer used in APIs
|
||||
*/
|
||||
CHEWING_API void chewing_free(void *);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Chewing IM Setup
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Reset all settings
|
||||
*
|
||||
* @param ctx
|
||||
* @return If successed than return 0
|
||||
*/
|
||||
CHEWING_API int chewing_Reset(ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
/*! \name Keyboard mapping
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set keyboard mapping type
|
||||
*
|
||||
* @param ctx
|
||||
* @param kbtype index number of keyboard mapping type from KBStr2Num
|
||||
* @return If successed then return 0
|
||||
*/
|
||||
CHEWING_API int chewing_set_KBType(ChewingContext *ctx, int kbtype);
|
||||
|
||||
/**
|
||||
* @brief Get keyboard mapping type
|
||||
*
|
||||
* @param ctx
|
||||
* @return If successed then return keyboard mapping type from KBStr2Num
|
||||
*/
|
||||
CHEWING_API int chewing_get_KBType(const ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Get keyboard mapping type in C-style string format
|
||||
* @see KBStr2Num()
|
||||
*
|
||||
* @param ctx
|
||||
* @return The name of the current keyboard layout. The caller must free it.
|
||||
*/
|
||||
CHEWING_API char *chewing_get_KBString(const ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Get the index number of keyboard mapping type from given string
|
||||
*
|
||||
* @param str[] name of kbtype eg. "KB_HSU"
|
||||
*/
|
||||
CHEWING_API int chewing_KBStr2Num(const char str[]);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Operating language mode of Chewing IM
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set the operating language mode of Chewing IM.
|
||||
*
|
||||
* @param ctx
|
||||
* @param mode CHINESE_MODE or ENGLISH_MODE
|
||||
*/
|
||||
CHEWING_API void chewing_set_ChiEngMode(ChewingContext *ctx, int mode);
|
||||
|
||||
/**
|
||||
* @brief Get current operating language mode: English / Chinese
|
||||
*
|
||||
* @param ctx
|
||||
*
|
||||
* @return CHINESE_MODE or ENGLISH_MODE
|
||||
*/
|
||||
CHEWING_API int chewing_get_ChiEngMode(const ChewingContext *ctx);
|
||||
|
||||
/*@*/
|
||||
|
||||
|
||||
/*! \name Shape mode of output symbols
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set the shape mode of output symbols: full-shape / half-shape
|
||||
*
|
||||
* @param ctx
|
||||
* @param mode FULLSHAPE_MODE or HALFSHAPE_MODE
|
||||
*/
|
||||
CHEWING_API void chewing_set_ShapeMode(ChewingContext *ctx, int mode);
|
||||
|
||||
/**
|
||||
* @brief Get current shape mode of output symbols
|
||||
*
|
||||
* @param ctx
|
||||
*
|
||||
* @return FULLSHAPE_MODE or HALFSHAPE_MODE
|
||||
*/
|
||||
CHEWING_API int chewing_get_ShapeMode(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Number of selection candidate per page
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set the number of selection candidate per page
|
||||
*
|
||||
* @param ctx
|
||||
* @param n number of selection candidate
|
||||
*/
|
||||
CHEWING_API void chewing_set_candPerPage(ChewingContext *ctx, int n);
|
||||
|
||||
/**
|
||||
* @brief Get the number of selection candidate per page
|
||||
*
|
||||
* @param ctx
|
||||
*/
|
||||
CHEWING_API int chewing_get_candPerPage(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Maximum length of Chinese symbols
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set the maximum length of Chinese symbols
|
||||
*
|
||||
* @param ctx
|
||||
* @param n maximum length
|
||||
*/
|
||||
CHEWING_API void chewing_set_maxChiSymbolLen(ChewingContext *ctx, int n);
|
||||
|
||||
/**
|
||||
* @brief Get the maximum length of Chinese symbols
|
||||
*
|
||||
* @param ctx
|
||||
*/
|
||||
CHEWING_API int chewing_get_maxChiSymbolLen(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Key sequence for selecting phrases
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set the key sequence for selecting phrases
|
||||
*
|
||||
* @param ctx
|
||||
* @param selkeys
|
||||
* @param len
|
||||
*/
|
||||
CHEWING_API void chewing_set_selKey(ChewingContext *ctx, const int *selkeys, int len);
|
||||
|
||||
/**
|
||||
* @brief Get the key sequence for selecting phrases
|
||||
*
|
||||
* @param ctx
|
||||
*/
|
||||
CHEWING_API int *chewing_get_selKey(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Direction of adding new user-defined phrases
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set the direction of adding new user-defined phrases
|
||||
*
|
||||
* @param ctx
|
||||
* @param direction
|
||||
*/
|
||||
CHEWING_API void chewing_set_addPhraseDirection(ChewingContext *ctx, int direction);
|
||||
|
||||
/**
|
||||
* @brief Get the direction of adding new user-defined phrases
|
||||
*
|
||||
* @param ctx
|
||||
*/
|
||||
CHEWING_API int chewing_get_addPhraseDirection(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Behavior whether if space key is regarded as selection key
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set the behavior whether if space key is regarded as selection key
|
||||
*
|
||||
* @param ctx
|
||||
* @param mode
|
||||
*/
|
||||
CHEWING_API void chewing_set_spaceAsSelection(ChewingContext *ctx, int mode);
|
||||
|
||||
/**
|
||||
* @brief Get the behavior if space key is regarded as selection key or not
|
||||
*
|
||||
* @param ctx
|
||||
*/
|
||||
CHEWING_API int chewing_get_spaceAsSelection(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Behavior whether if Escape should clean all buffer
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set the behavior whether if Escape key should clean all buffer
|
||||
*
|
||||
* @param ctx
|
||||
* @param mode
|
||||
*/
|
||||
CHEWING_API void chewing_set_escCleanAllBuf(ChewingContext *ctx, int mode);
|
||||
|
||||
/**
|
||||
* @brief Get the behavior whether if Escape key should clean all buffer
|
||||
*
|
||||
* @param ctx
|
||||
*/
|
||||
CHEWING_API int chewing_get_escCleanAllBuf(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Behavior of automatically shifting cursor after selection
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set the behavior of automatically shifting cursor after selection
|
||||
*
|
||||
* @param ctx
|
||||
* @param mode
|
||||
*/
|
||||
CHEWING_API void chewing_set_autoShiftCur(ChewingContext *ctx, int mode);
|
||||
|
||||
/**
|
||||
* @brief Get the behavior of automatically shifting cursor after selection
|
||||
*
|
||||
* @param ctx
|
||||
*/
|
||||
CHEWING_API int chewing_get_autoShiftCur(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Operating mode during easy symbol input
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set the operating mode during easy symbol input
|
||||
*
|
||||
* @param ctx
|
||||
* @param mode
|
||||
*/
|
||||
CHEWING_API void chewing_set_easySymbolInput(ChewingContext *ctx, int mode);
|
||||
|
||||
/**
|
||||
* @brief Get the operating mode during easy symbol input
|
||||
*
|
||||
* @param ctx
|
||||
*/
|
||||
CHEWING_API int chewing_get_easySymbolInput(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Behavior for phrase choice to be rearward or not
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set the behavior for phrase choice to be rearward or not
|
||||
*
|
||||
* @param ctx
|
||||
* @param mode
|
||||
*/
|
||||
CHEWING_API void chewing_set_phraseChoiceRearward(ChewingContext *ctx, int mode);
|
||||
|
||||
/**
|
||||
* @brief Get the behavior for phrase choice to be rearward or not
|
||||
*
|
||||
* @param ctx
|
||||
*/
|
||||
CHEWING_API int chewing_get_phraseChoiceRearward(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Behavior of automatic learning after committing
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Set the behavior of automatic learning
|
||||
*
|
||||
* @param ctx
|
||||
* @param mode AUTOLEARN_ENABLED or AUTOLEARN_DISABLED
|
||||
*/
|
||||
CHEWING_API void chewing_set_autoLearn(ChewingContext *ctx, int mode);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get the behavior of automatic learning
|
||||
*
|
||||
* @param ctx
|
||||
* @return AUTOLEARN_ENABLED or AUTOLEARN_DISABLED
|
||||
*/
|
||||
CHEWING_API int chewing_get_autoLearn(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*! \name Phonetic sequence in Chewing internal state machine
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
/**
|
||||
* @brief Get phonetic sequence in Chewing internal state machine
|
||||
*
|
||||
* @param ctx
|
||||
*/
|
||||
CHEWING_API unsigned short *chewing_get_phoneSeq(const ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Get the length of phonetic sequence in Chewing internal state machine
|
||||
*
|
||||
* @param ctx
|
||||
*/
|
||||
CHEWING_API int chewing_get_phoneSeqLen(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
CHEWING_API void chewing_set_logger(ChewingContext *ctx,
|
||||
void (*logger) (void *data, int level, const char *fmt, ...), void *data);
|
||||
|
||||
CHEWING_API int chewing_userphrase_enumerate(ChewingContext *ctx);
|
||||
|
||||
CHEWING_API int chewing_userphrase_has_next(ChewingContext *ctx, unsigned int *phrase_len, unsigned int *bopomofo_len);
|
||||
|
||||
CHEWING_API int chewing_userphrase_get(ChewingContext *ctx,
|
||||
char *phrase_buf, unsigned int phrase_len,
|
||||
char *bopomofo_buf, unsigned int bopomofo_len);
|
||||
|
||||
CHEWING_API int chewing_userphrase_add(ChewingContext *ctx, const char *phrase_buf, const char *bopomofo_buf);
|
||||
|
||||
CHEWING_API int chewing_userphrase_remove(ChewingContext *ctx, const char *phrase_buf, const char *bopomofo_buf);
|
||||
|
||||
CHEWING_API int chewing_userphrase_lookup(ChewingContext *ctx, const char *phrase_buf, const char *bopomofo_buf);
|
||||
|
||||
CHEWING_API int chewing_cand_list_first(ChewingContext *ctx);
|
||||
CHEWING_API int chewing_cand_list_last(ChewingContext *ctx);
|
||||
CHEWING_API int chewing_cand_list_has_next(ChewingContext *ctx);
|
||||
CHEWING_API int chewing_cand_list_has_prev(ChewingContext *ctx);
|
||||
CHEWING_API int chewing_cand_list_next(ChewingContext *ctx);
|
||||
CHEWING_API int chewing_cand_list_prev(ChewingContext *ctx);
|
||||
|
||||
CHEWING_API int chewing_commit_preedit_buf(ChewingContext *ctx);
|
||||
CHEWING_API int chewing_clean_preedit_buf(ChewingContext *ctx);
|
||||
|
||||
CHEWING_API int chewing_clean_bopomofo_buf(ChewingContext *ctx);
|
||||
|
||||
CHEWING_API ChewingContext *chewing_new2(const char *syspath,
|
||||
const char *userpath,
|
||||
void (*logger) (void *data, int level, const char *fmt, ...),
|
||||
void *loggerdata);
|
||||
|
||||
CHEWING_API int chewing_phone_to_bopomofo(unsigned short phone, char *buf, unsigned short len);
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
#endif /* _CHEWING_IO_H */
|
||||
/* *INDENT-ON* */
|
||||
#include "chewing.h"
|
||||
|
|
@ -1,124 +1,3 @@
|
|||
/*
|
||||
* global.h
|
||||
*
|
||||
* Copyright (c) 1999, 2000, 2001
|
||||
* Lu-chuan Kung and Kang-pen Chen.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Copyright (c) 2004, 2005, 2006, 2008, 2011
|
||||
* libchewing Core Team. See ChangeLog for details.
|
||||
*
|
||||
* See the file "COPYING" for information on usage and redistribution
|
||||
* of this file.
|
||||
*/
|
||||
#warning "This header is deprecated. Include <chewing.h> directly."
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
#ifndef _CHEWING_GLOBAL_H
|
||||
#define _CHEWING_GLOBAL_H
|
||||
/* *INDENT-ON* */
|
||||
|
||||
/*! \file global.h
|
||||
* \brief Chewing Global Definitions
|
||||
* \author libchewing Core Team
|
||||
*/
|
||||
|
||||
#define CHINESE_MODE 1
|
||||
#define SYMBOL_MODE 0
|
||||
#define FULLSHAPE_MODE 1
|
||||
#define HALFSHAPE_MODE 0
|
||||
#define AUTOLEARN_DISABLED 1
|
||||
#define AUTOLEARN_ENABLED 0
|
||||
|
||||
/* specified to Chewing API */
|
||||
#if defined(_WIN32) || defined(_WIN64) || defined(_WIN32_WCE)
|
||||
# define CHEWING_DLL_IMPORT __declspec(dllimport)
|
||||
# define CHEWING_DLL_EXPORT __declspec(dllexport)
|
||||
# ifdef CHEWINGDLL_EXPORTS
|
||||
# define CHEWING_API CHEWING_DLL_EXPORT
|
||||
# define CHEWING_PRIVATE
|
||||
# elif CHEWINGDLL_IMPORTS
|
||||
# define CHEWING_API CHEWING_DLL_IMPORT
|
||||
# define CHEWING_PRIVATE
|
||||
# else
|
||||
# define CHEWING_API
|
||||
# define CHEWING_PRIVATE
|
||||
# endif
|
||||
#elif (__GNUC__ > 3) && (defined(__ELF__) || defined(__PIC__))
|
||||
# define CHEWING_API __attribute__((__visibility__("default")))
|
||||
# define CHEWING_PRIVATE __attribute__((__visibility__("hidden")))
|
||||
#else
|
||||
# define CHEWING_API
|
||||
# define CHEWING_PRIVATE
|
||||
#endif
|
||||
|
||||
#ifndef UNUSED
|
||||
# if defined(__GNUC__) /* gcc specific */
|
||||
# define UNUSED __attribute__((unused))
|
||||
# else
|
||||
# define UNUSED
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef DEPRECATED
|
||||
# if defined(__GNUC__) && __GNUC__ > 3 || \
|
||||
(__GNUC__ == 3 && __GNUC_MINOR__ >= 1) /* gcc specific */
|
||||
# define DEPRECATED __attribute__((deprecated))
|
||||
# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
|
||||
# define DEPRECATED_FOR(f) \
|
||||
__attribute__((deprecated("Use " #f " instead")))
|
||||
# else
|
||||
# define DEPRECATED_FOR(f) DEPRECATED
|
||||
# endif
|
||||
# else
|
||||
# define DEPRECATED
|
||||
# define DEPRECATED_FOR(f)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define MIN_SELKEY 1
|
||||
#define MAX_SELKEY 10
|
||||
|
||||
#define CHEWING_LOG_VERBOSE 1
|
||||
#define CHEWING_LOG_DEBUG 2
|
||||
#define CHEWING_LOG_INFO 3
|
||||
#define CHEWING_LOG_WARN 4
|
||||
#define CHEWING_LOG_ERROR 5
|
||||
|
||||
/**
|
||||
* @deprecated Use chewing_set_ series of functions to set parameters instead.
|
||||
*/
|
||||
typedef struct ChewingConfigData {
|
||||
int candPerPage;
|
||||
int maxChiSymbolLen;
|
||||
int selKey[MAX_SELKEY];
|
||||
int bAddPhraseForward;
|
||||
int bSpaceAsSelection;
|
||||
int bEscCleanAllBuf;
|
||||
int bAutoShiftCur;
|
||||
int bEasySymbolInput;
|
||||
int bPhraseChoiceRearward;
|
||||
int hsuSelKeyType; // Deprecated.
|
||||
} ChewingConfigData;
|
||||
|
||||
typedef struct IntervalType {
|
||||
/*@{ */
|
||||
int from; /**< starting position of certain interval */
|
||||
int to; /**< ending position of certain interval */
|
||||
/*@} */
|
||||
} IntervalType;
|
||||
|
||||
/** @brief context handle used for Chewing IM APIs
|
||||
*/
|
||||
typedef struct ChewingContext ChewingContext;
|
||||
|
||||
/** @brief use "asdfjkl789" as selection key
|
||||
*/
|
||||
#define HSU_SELKEY_TYPE1 1
|
||||
|
||||
/** @brief use "asdfzxcv89" as selection key
|
||||
*/
|
||||
#define HSU_SELKEY_TYPE2 2
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
#endif
|
||||
/* *INDENT-ON* */
|
||||
#include "chewing.h"
|
||||
|
|
@ -1,117 +1,3 @@
|
|||
/*
|
||||
* mod_aux.h
|
||||
*
|
||||
* Copyright (c) 2005, 2008
|
||||
* libchewing Core Team. See ChangeLog for details.
|
||||
*
|
||||
* See the file "COPYING" for information on usage and redistribution
|
||||
* of this file.
|
||||
*/
|
||||
#warning "This header is deprecated. Include <chewing.h> directly."
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
#ifndef CHEWING_MOD_AUX_H
|
||||
#define CHEWING_MOD_AUX_H
|
||||
/* *INDENT-ON* */
|
||||
|
||||
/*! \file mod_aux.h
|
||||
* \brief Auxiliary module
|
||||
* \author libchewing Core Team
|
||||
*/
|
||||
|
||||
#ifdef WITH_RUST
|
||||
# include "chewing_rs.h"
|
||||
#else
|
||||
# include "global.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Chewing the state for input context during commit process
|
||||
* @param ctx handle to Chewing IM context
|
||||
* @retval TRUE if its currnet input state is at the "end-of-a-char"
|
||||
*/
|
||||
CHEWING_API int chewing_commit_Check(const ChewingContext *ctx);
|
||||
|
||||
/**
|
||||
* @brief Get current commit string regardless of current input state
|
||||
* @param ctx handle to Chewing IM context
|
||||
*
|
||||
* Always returns a char pointer, caller must free it.
|
||||
*/
|
||||
CHEWING_API char *chewing_commit_String(const ChewingContext *ctx);
|
||||
CHEWING_API const char *chewing_commit_String_static(const ChewingContext *ctx);
|
||||
|
||||
|
||||
/*! \name Preedit string buffer
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
CHEWING_API char *chewing_buffer_String(const ChewingContext *ctx);
|
||||
CHEWING_API const char *chewing_buffer_String_static(const ChewingContext *ctx);
|
||||
CHEWING_API int chewing_buffer_Check(const ChewingContext *ctx);
|
||||
CHEWING_API int chewing_buffer_Len(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*@{*/
|
||||
CHEWING_API const char *chewing_bopomofo_String_static(const ChewingContext *ctx);
|
||||
CHEWING_API int chewing_bopomofo_Check(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
CHEWING_API int chewing_cursor_Current(const ChewingContext *ctx);
|
||||
|
||||
/*@{*/
|
||||
CHEWING_API int chewing_cand_CheckDone(const ChewingContext *ctx);
|
||||
CHEWING_API int chewing_cand_TotalPage(const ChewingContext *ctx);
|
||||
CHEWING_API int chewing_cand_ChoicePerPage(const ChewingContext *ctx);
|
||||
CHEWING_API int chewing_cand_TotalChoice(const ChewingContext *ctx);
|
||||
CHEWING_API int chewing_cand_CurrentPage(const ChewingContext *ctx);
|
||||
CHEWING_API void chewing_cand_Enumerate(ChewingContext *ctx);
|
||||
CHEWING_API int chewing_cand_hasNext(ChewingContext *ctx);
|
||||
CHEWING_API char *chewing_cand_String(ChewingContext *ctx);
|
||||
CHEWING_API const char *chewing_cand_String_static(ChewingContext *ctx);
|
||||
CHEWING_API char *chewing_cand_string_by_index(ChewingContext *ctx, int index);
|
||||
CHEWING_API const char *chewing_cand_string_by_index_static(ChewingContext *ctx, int index);
|
||||
CHEWING_API int chewing_cand_choose_by_index(ChewingContext *ctx, int index);
|
||||
CHEWING_API int chewing_cand_open(ChewingContext *ctx);
|
||||
CHEWING_API int chewing_cand_close(ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*@{*/
|
||||
CHEWING_API void chewing_interval_Enumerate(ChewingContext *ctx);
|
||||
CHEWING_API int chewing_interval_hasNext(ChewingContext *ctx);
|
||||
CHEWING_API void chewing_interval_Get(ChewingContext *ctx, IntervalType * it);
|
||||
|
||||
/*@}*/
|
||||
|
||||
/*@{*/
|
||||
CHEWING_API int chewing_aux_Check(const ChewingContext *ctx);
|
||||
CHEWING_API int chewing_aux_Length(const ChewingContext *ctx);
|
||||
CHEWING_API char *chewing_aux_String(const ChewingContext *ctx);
|
||||
CHEWING_API const char *chewing_aux_String_static(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*@{*/
|
||||
CHEWING_API int chewing_keystroke_CheckIgnore(const ChewingContext *ctx);
|
||||
CHEWING_API int chewing_keystroke_CheckAbsorb(const ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*@{*/
|
||||
CHEWING_API int chewing_kbtype_Total(const ChewingContext *ctx);
|
||||
CHEWING_API void chewing_kbtype_Enumerate(ChewingContext *ctx);
|
||||
CHEWING_API int chewing_kbtype_hasNext(ChewingContext *ctx);
|
||||
CHEWING_API char *chewing_kbtype_String(ChewingContext *ctx);
|
||||
CHEWING_API const char *chewing_kbtype_String_static(ChewingContext *ctx);
|
||||
|
||||
/*@}*/
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
#endif /* CHEWING_MOD_AUX_H */
|
||||
/* *INDENT-ON* */
|
||||
#include "chewing.h"
|
||||
28
libchewing/x86_64/lib/cmake/Chewing/ChewingConfig.cmake
Normal file
28
libchewing/x86_64/lib/cmake/Chewing/ChewingConfig.cmake
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
|
||||
####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() #######
|
||||
####### Any changes to this file will be overwritten by the next CMake run ####
|
||||
####### The input file was ChewingConfig.cmake.in ########
|
||||
|
||||
get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE)
|
||||
|
||||
macro(set_and_check _var _file)
|
||||
set(${_var} "${_file}")
|
||||
if(NOT EXISTS "${_file}")
|
||||
message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(check_required_components _NAME)
|
||||
foreach(comp ${${_NAME}_FIND_COMPONENTS})
|
||||
if(NOT ${_NAME}_${comp}_FOUND)
|
||||
if(${_NAME}_FIND_REQUIRED_${comp})
|
||||
set(${_NAME}_FOUND FALSE)
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
####################################################################################
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/ChewingTargets.cmake")
|
||||
check_required_components(Chewing)
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
# This is a basic version file for the Config-mode of find_package().
|
||||
# It is used by write_basic_package_version_file() as input file for configure_file()
|
||||
# to create a version-file which can be installed along a config.cmake file.
|
||||
#
|
||||
# The created file sets PACKAGE_VERSION_EXACT if the current version string and
|
||||
# the requested version string are exactly the same and it sets
|
||||
# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version,
|
||||
# but only if the requested major version is the same as the current one.
|
||||
# The variable CVF_VERSION must be set before calling configure_file().
|
||||
|
||||
|
||||
set(PACKAGE_VERSION "a6a8fa4-dirty")
|
||||
|
||||
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
else()
|
||||
|
||||
if("a6a8fa4-dirty" MATCHES "^([0-9]+)\\.")
|
||||
set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}")
|
||||
if(NOT CVF_VERSION_MAJOR VERSION_EQUAL 0)
|
||||
string(REGEX REPLACE "^0+" "" CVF_VERSION_MAJOR "${CVF_VERSION_MAJOR}")
|
||||
endif()
|
||||
else()
|
||||
set(CVF_VERSION_MAJOR "a6a8fa4-dirty")
|
||||
endif()
|
||||
|
||||
if(PACKAGE_FIND_VERSION_RANGE)
|
||||
# both endpoints of the range must have the expected major version
|
||||
math (EXPR CVF_VERSION_MAJOR_NEXT "${CVF_VERSION_MAJOR} + 1")
|
||||
if (NOT PACKAGE_FIND_VERSION_MIN_MAJOR STREQUAL CVF_VERSION_MAJOR
|
||||
OR ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND NOT PACKAGE_FIND_VERSION_MAX_MAJOR STREQUAL CVF_VERSION_MAJOR)
|
||||
OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND NOT PACKAGE_FIND_VERSION_MAX VERSION_LESS_EQUAL CVF_VERSION_MAJOR_NEXT)))
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
elseif(PACKAGE_FIND_VERSION_MIN_MAJOR STREQUAL CVF_VERSION_MAJOR
|
||||
AND ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_LESS_EQUAL PACKAGE_FIND_VERSION_MAX)
|
||||
OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION_MAX)))
|
||||
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||
else()
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
endif()
|
||||
else()
|
||||
if(PACKAGE_FIND_VERSION_MAJOR STREQUAL CVF_VERSION_MAJOR)
|
||||
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||
else()
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
endif()
|
||||
|
||||
if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
|
||||
set(PACKAGE_VERSION_EXACT TRUE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
|
||||
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "8" STREQUAL "")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
|
||||
if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "8")
|
||||
math(EXPR installedBits "8 * 8")
|
||||
set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
|
||||
set(PACKAGE_VERSION_UNSUITABLE TRUE)
|
||||
endif()
|
||||
107
libchewing/x86_64/lib/cmake/Chewing/ChewingTargets.cmake
Normal file
107
libchewing/x86_64/lib/cmake/Chewing/ChewingTargets.cmake
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
# Generated by CMake
|
||||
|
||||
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.8)
|
||||
message(FATAL_ERROR "CMake >= 3.0.0 required")
|
||||
endif()
|
||||
if(CMAKE_VERSION VERSION_LESS "3.0.0")
|
||||
message(FATAL_ERROR "CMake >= 3.0.0 required")
|
||||
endif()
|
||||
cmake_policy(PUSH)
|
||||
cmake_policy(VERSION 3.0.0...3.29)
|
||||
#----------------------------------------------------------------
|
||||
# Generated CMake target import file.
|
||||
#----------------------------------------------------------------
|
||||
|
||||
# Commands may need to know the format version.
|
||||
set(CMAKE_IMPORT_FILE_VERSION 1)
|
||||
|
||||
# Protect against multiple inclusion, which would fail when already imported targets are added once more.
|
||||
set(_cmake_targets_defined "")
|
||||
set(_cmake_targets_not_defined "")
|
||||
set(_cmake_expected_targets "")
|
||||
foreach(_cmake_expected_target IN ITEMS Chewing::chewing_capi)
|
||||
list(APPEND _cmake_expected_targets "${_cmake_expected_target}")
|
||||
if(TARGET "${_cmake_expected_target}")
|
||||
list(APPEND _cmake_targets_defined "${_cmake_expected_target}")
|
||||
else()
|
||||
list(APPEND _cmake_targets_not_defined "${_cmake_expected_target}")
|
||||
endif()
|
||||
endforeach()
|
||||
unset(_cmake_expected_target)
|
||||
if(_cmake_targets_defined STREQUAL _cmake_expected_targets)
|
||||
unset(_cmake_targets_defined)
|
||||
unset(_cmake_targets_not_defined)
|
||||
unset(_cmake_expected_targets)
|
||||
unset(CMAKE_IMPORT_FILE_VERSION)
|
||||
cmake_policy(POP)
|
||||
return()
|
||||
endif()
|
||||
if(NOT _cmake_targets_defined STREQUAL "")
|
||||
string(REPLACE ";" ", " _cmake_targets_defined_text "${_cmake_targets_defined}")
|
||||
string(REPLACE ";" ", " _cmake_targets_not_defined_text "${_cmake_targets_not_defined}")
|
||||
message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_cmake_targets_defined_text}\nTargets not yet defined: ${_cmake_targets_not_defined_text}\n")
|
||||
endif()
|
||||
unset(_cmake_targets_defined)
|
||||
unset(_cmake_targets_not_defined)
|
||||
unset(_cmake_expected_targets)
|
||||
|
||||
|
||||
# Compute the installation prefix relative to this file.
|
||||
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
|
||||
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
|
||||
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
|
||||
if(_IMPORT_PREFIX STREQUAL "/")
|
||||
set(_IMPORT_PREFIX "")
|
||||
endif()
|
||||
|
||||
# Create imported target Chewing::chewing_capi
|
||||
add_library(Chewing::chewing_capi INTERFACE IMPORTED)
|
||||
|
||||
set_target_properties(Chewing::chewing_capi PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
|
||||
INTERFACE_LINK_LIBRARIES "chewing_capi-static"
|
||||
)
|
||||
|
||||
# Load information for each installed configuration.
|
||||
file(GLOB _cmake_config_files "${CMAKE_CURRENT_LIST_DIR}/ChewingTargets-*.cmake")
|
||||
foreach(_cmake_config_file IN LISTS _cmake_config_files)
|
||||
include("${_cmake_config_file}")
|
||||
endforeach()
|
||||
unset(_cmake_config_file)
|
||||
unset(_cmake_config_files)
|
||||
|
||||
# Cleanup temporary variables.
|
||||
set(_IMPORT_PREFIX)
|
||||
|
||||
# Loop over all imported files and verify that they actually exist
|
||||
foreach(_cmake_target IN LISTS _cmake_import_check_targets)
|
||||
if(CMAKE_VERSION VERSION_LESS "3.28"
|
||||
OR NOT DEFINED _cmake_import_check_xcframework_for_${_cmake_target}
|
||||
OR NOT IS_DIRECTORY "${_cmake_import_check_xcframework_for_${_cmake_target}}")
|
||||
foreach(_cmake_file IN LISTS "_cmake_import_check_files_for_${_cmake_target}")
|
||||
if(NOT EXISTS "${_cmake_file}")
|
||||
message(FATAL_ERROR "The imported target \"${_cmake_target}\" references the file
|
||||
\"${_cmake_file}\"
|
||||
but this file does not exist. Possible reasons include:
|
||||
* The file was deleted, renamed, or moved to another location.
|
||||
* An install or uninstall procedure did not complete successfully.
|
||||
* The installation package was faulty and contained
|
||||
\"${CMAKE_CURRENT_LIST_FILE}\"
|
||||
but not all the files it references.
|
||||
")
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
unset(_cmake_file)
|
||||
unset("_cmake_import_check_files_for_${_cmake_target}")
|
||||
endforeach()
|
||||
unset(_cmake_target)
|
||||
unset(_cmake_import_check_targets)
|
||||
|
||||
# This file does not depend on other imported targets which have
|
||||
# been exported from the same project but in a separate export set.
|
||||
|
||||
# Commands beyond this point should not need to know the version.
|
||||
set(CMAKE_IMPORT_FILE_VERSION)
|
||||
cmake_policy(POP)
|
||||
Binary file not shown.
BIN
libchewing/x86_64/lib/libchewing_capi.a
Normal file
BIN
libchewing/x86_64/lib/libchewing_capi.a
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue