rime_api.h | rime_api.h | |||
---|---|---|---|---|
/* vim: set sts=2 sw=2 et: | /* | |||
* encoding: utf-8 | ||||
* | ||||
* Copyleft 2011 RIME Developers | * Copyleft 2011 RIME Developers | |||
* License: GPLv3 | * License: GPLv3 | |||
* | * | |||
* 2011-08-08 GONG Chen <chen.sst@gmail.com> | * 2011-08-08 GONG Chen <chen.sst@gmail.com> | |||
*/ | */ | |||
#ifndef RIME_API_H_ | #ifndef RIME_API_H_ | |||
#define RIME_API_H_ | #define RIME_API_H_ | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
skipping to change at line 132 | skipping to change at line 130 | |||
char* schema_id; | char* schema_id; | |||
char* name; | char* name; | |||
void* unused; | void* unused; | |||
} RimeSchemaListItem; | } RimeSchemaListItem; | |||
typedef struct { | typedef struct { | |||
size_t size; | size_t size; | |||
RimeSchemaListItem* list; | RimeSchemaListItem* list; | |||
} RimeSchemaList; | } RimeSchemaList; | |||
// entry and exit | typedef void (*RimeNotificationHandler)(void* context_object, | |||
RimeSessionId session_id, | ||||
const char* message_type, | ||||
const char* message_value); | ||||
// setup | ||||
// call this function before accessing any other API. | // call this function before accessing any other API. | |||
// pass a C-string constant in the format "rime.x" | // pass a C-string constant in the format "rime.x" | |||
// where 'x' is the name of your application. | // where 'x' is the name of your application. | |||
// the prefix "rime." ensures old log files are automatically cleaned. | // adding prefix "rime." ensures old log files are automatically cleaned. | |||
// | ||||
RIME_API void RimeSetupLogging(const char* app_name); | RIME_API void RimeSetupLogging(const char* app_name); | |||
// receive notifications | ||||
// on loading schema: | ||||
// message_type="schema", message_value="luna_pinyin/Luna Pinyin" | ||||
// on changing mode: | ||||
// message_type="option", message_value="ascii_mode" | ||||
// message_type="option", message_value="!ascii_mode" | ||||
// on deployment: | ||||
// session_id = 0, message_type="deploy", message_value="start" | ||||
// session_id = 0, message_type="deploy", message_value="success" | ||||
// session_id = 0, message_type="deploy", message_value="failure" | ||||
// | ||||
// @handler will be called with @context_object as the first parameter | ||||
// every time an event occurs in librime, until RimeFinalize() is called. | ||||
// when @handler is NULL, notification is disabled. | ||||
// | ||||
RIME_API void RimeSetNotificationHandler(RimeNotificationHandler handler, | ||||
void* context_object); | ||||
// entry and exit | ||||
RIME_API void RimeInitialize(RimeTraits *traits); | RIME_API void RimeInitialize(RimeTraits *traits); | |||
RIME_API void RimeFinalize(); | RIME_API void RimeFinalize(); | |||
RIME_API Bool RimeStartMaintenance(Bool full_check); | RIME_API Bool RimeStartMaintenance(Bool full_check); | |||
RIME_API Bool RimeStartMaintenanceOnWorkspaceChange(); | RIME_API Bool RimeStartMaintenanceOnWorkspaceChange(); | |||
RIME_API Bool RimeIsMaintenancing(); | RIME_API Bool RimeIsMaintenancing(); | |||
RIME_API void RimeJoinMaintenanceThread(); | RIME_API void RimeJoinMaintenanceThread(); | |||
// deployment | // deployment | |||
RIME_API void RimeDeployerInitialize(RimeTraits *traits); | RIME_API void RimeDeployerInitialize(RimeTraits *traits); | |||
RIME_API Bool RimePrebuildAllSchemas(); | RIME_API Bool RimePrebuildAllSchemas(); | |||
RIME_API Bool RimeDeployWorkspace(); | RIME_API Bool RimeDeployWorkspace(); | |||
RIME_API Bool RimeDeploySchema(const char *schema_file); | RIME_API Bool RimeDeploySchema(const char *schema_file); | |||
RIME_API Bool RimeDeployConfigFile(const char *file_name, const char *versi on_key); | RIME_API Bool RimeDeployConfigFile(const char *file_name, const char *versi on_key); | |||
RIME_API Bool RimeSyncUserData(); | ||||
// session management | // session management | |||
RIME_API RimeSessionId RimeCreateSession(); | RIME_API RimeSessionId RimeCreateSession(); | |||
RIME_API Bool RimeFindSession(RimeSessionId session_id); | RIME_API Bool RimeFindSession(RimeSessionId session_id); | |||
RIME_API Bool RimeDestroySession(RimeSessionId session_id); | RIME_API Bool RimeDestroySession(RimeSessionId session_id); | |||
RIME_API void RimeCleanupStaleSessions(); | RIME_API void RimeCleanupStaleSessions(); | |||
RIME_API void RimeCleanupAllSessions(); | RIME_API void RimeCleanupAllSessions(); | |||
// input | // input | |||
skipping to change at line 185 | skipping to change at line 211 | |||
RIME_API Bool RimeGetContext(RimeSessionId session_id, RimeContext* context ); | RIME_API Bool RimeGetContext(RimeSessionId session_id, RimeContext* context ); | |||
RIME_API Bool RimeFreeContext(RimeContext* context); | RIME_API Bool RimeFreeContext(RimeContext* context); | |||
RIME_API Bool RimeGetStatus(RimeSessionId session_id, RimeStatus* status); | RIME_API Bool RimeGetStatus(RimeSessionId session_id, RimeStatus* status); | |||
RIME_API Bool RimeFreeStatus(RimeStatus* status); | RIME_API Bool RimeFreeStatus(RimeStatus* status); | |||
// runtime options | // runtime options | |||
RIME_API void RimeSetOption(RimeSessionId session_id, const char* option, B ool value); | RIME_API void RimeSetOption(RimeSessionId session_id, const char* option, B ool value); | |||
RIME_API Bool RimeGetOption(RimeSessionId session_id, const char* option); | RIME_API Bool RimeGetOption(RimeSessionId session_id, const char* option); | |||
RIME_API void RimeSetProperty(RimeSessionId session_id, const char* prop, c | ||||
onst char* value); | ||||
RIME_API Bool RimeGetProperty(RimeSessionId session_id, const char* prop, c | ||||
har* value, size_t buffer_size); | ||||
RIME_API Bool RimeGetSchemaList(RimeSchemaList* schema_list); | RIME_API Bool RimeGetSchemaList(RimeSchemaList* schema_list); | |||
RIME_API void RimeFreeSchemaList(RimeSchemaList* schema_list); | RIME_API void RimeFreeSchemaList(RimeSchemaList* schema_list); | |||
RIME_API Bool RimeGetCurrentSchema(RimeSessionId session_id, char* schema_i d, size_t buffer_size); | RIME_API Bool RimeGetCurrentSchema(RimeSessionId session_id, char* schema_i d, size_t buffer_size); | |||
RIME_API Bool RimeSelectSchema(RimeSessionId session_id, const char* schema _id); | RIME_API Bool RimeSelectSchema(RimeSessionId session_id, const char* schema _id); | |||
// configuration | // configuration | |||
RIME_API Bool RimeConfigOpen(const char *config_id, RimeConfig* config); | RIME_API Bool RimeConfigOpen(const char *config_id, RimeConfig* config); | |||
RIME_API Bool RimeConfigClose(RimeConfig *config); | RIME_API Bool RimeConfigClose(RimeConfig *config); | |||
RIME_API Bool RimeConfigGetBool(RimeConfig *config, const char *key, Bool * value); | RIME_API Bool RimeConfigGetBool(RimeConfig *config, const char *key, Bool * value); | |||
End of changes. 6 change blocks. | ||||
5 lines changed or deleted | 36 lines changed or added | |||