diff -up libchewing-0.3.0/src/chewingio.c.8-bz220694 libchewing/trunk/src/chewingio.c --- libchewing-0.3.0/src/chewingio.c.8-bz220694 2008-01-03 07:49:12.000000000 +1000 +++ libchewing-0.3.0/src/chewingio.c 2008-01-03 07:49:12.000000000 +1000 @@ -187,6 +187,11 @@ CHEWING_API int chewing_set_KBType( Chew return 0; } +CHEWING_API int chewing_get_KBType( ChewingContext *ctx ) +{ + return ctx->data->zuinData.kbtype; +} + CHEWING_API void chewing_Terminate() { int i; diff -up libchewing-0.3.0/src/porting_layer/src/plat_mmap_posix.c.8-bz220694 libchewing/trunk/src/porting_layer/src/plat_mmap_posix.c --- libchewing-0.3.0/src/porting_layer/src/plat_mmap_posix.c.8-bz220694 2008-01-03 07:49:52.000000000 +1000 +++ libchewing-0.3.0/src/porting_layer/src/plat_mmap_posix.c 2008-01-03 07:50:07.000000000 +1000 @@ -48,7 +48,7 @@ size_t plat_mmap_create( plat_mmap *hand if ( FLAG_ATTRIBUTE_READ & fileAccessAttr ) handle->fd = open( file, O_RDONLY ); else - handle->fd = open( file, O_RDWR | O_CREAT ); + handle->fd = open( file, O_RDWR ); if ( handle->fd == -1 ) return 0; diff -up libchewing-0.3.0/include/global.h.8-bz220694 libchewing/trunk/include/global.h --- libchewing-0.3.0/include/global.h.8-bz220694 2006-05-15 16:49:41.000000000 +1000 +++ libchewing-0.3.0/include/global.h 2008-01-03 07:49:12.000000000 +1000 @@ -32,6 +32,18 @@ #define FULLSHAPE_MODE 1 #define HALFSHAPE_MODE 0 +#define DEFAULT_KBTYPE 0 +#define HSU_KBTYPE 1 +#define IBM_KBTYPE 2 +#define GINYIEH_KBTYPE 3 +#define ETEN_KBTYPE 4 +#define ETEN26_KBTYPE 5 +#define DVORAK_KBTYPE 6 +#define DVORAKHSU_KBTYPE 7 +#define HANYU_KBTYPE 8 +#define FIRST_KBTYPE DEFAULT_KBTYPE +#define LAST_KBTYPE HANYU_KBTYPE + #define MAX_KBTYPE 10 #define MAX_SELKEY 10 #define WCH_SIZE 4 diff -up libchewing-0.3.0/include/chewingio.h.8-bz220694 libchewing/trunk/include/chewingio.h --- libchewing-0.3.0/include/chewingio.h.8-bz220694 2008-01-03 07:49:12.000000000 +1000 +++ libchewing-0.3.0/include/chewingio.h 2008-01-03 07:49:12.000000000 +1000 @@ -99,6 +99,14 @@ CHEWING_API int chewing_Reset( ChewingCo CHEWING_API int chewing_set_KBType( ChewingContext *ctx, int kbtype ); /** + * @breif Set keyboard type + * + * @param ctx + * @return If successed then return 0 + */ +CHEWING_API int chewing_get_KBType( ChewingContext *ctx ); + +/** * @brief Terminate chewing * * Terminate the I/O routines for chewing. @@ -114,11 +122,11 @@ CHEWING_API void chewing_Terminate(); CHEWING_API void chewing_set_ChiEngMode( ChewingContext *ctx, int mode ); /** - * @brief Get chewing's current mode + * @brief Get chewing's current keyboard type * * @param ctx * - * @return CHINESE_MODE or ENGLISH_MODE + * @return DEFAULT_KBTYPE or HANYU_KBTYPE */ CHEWING_API int chewing_get_ChiEngMode( ChewingContext *ctx );