parent
a89f4ac2d3
commit
bd37227f87
@ -1,2 +1,3 @@
|
|||||||
libchewing-0.3.2.tar.bz2
|
libchewing-0.3.2.tar.bz2
|
||||||
/libchewing-0.3.2.tar.bz2
|
/libchewing-0.3.2.tar.bz2
|
||||||
|
/libchewing-0.3.3.tar.bz2
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
diff -up ./include/internal/chewing-private.h.align ./include/internal/chewing-private.h
|
|
||||||
--- ./include/internal/chewing-private.h.align 2008-12-02 00:29:20.000000000 +1000
|
|
||||||
+++ ./include/internal/chewing-private.h 2010-09-02 17:14:12.565544961 +1000
|
|
||||||
@@ -37,6 +37,7 @@
|
|
||||||
typedef union {
|
|
||||||
unsigned char s[ MAX_UTF8_SIZE + 1];
|
|
||||||
wchar_t wch;
|
|
||||||
+ unsigned char padding[8]; /* Ensure this structure is aligned */
|
|
||||||
} wch_t;
|
|
||||||
|
|
||||||
typedef struct {
|
|
@ -1,50 +0,0 @@
|
|||||||
diff -up ./data/Makefile.am.bz477690 ./data/Makefile.am
|
|
||||||
--- ./data/Makefile.am.bz477690 2008-12-02 00:29:20.000000000 +1000
|
|
||||||
+++ ./data/Makefile.am 2009-05-20 14:24:31.000000000 +1000
|
|
||||||
@@ -9,8 +9,11 @@ datas = \
|
|
||||||
us_freq.dat \
|
|
||||||
dict.dat \
|
|
||||||
ph_index.dat \
|
|
||||||
- fonetree.dat \
|
|
||||||
$(chindexs)
|
|
||||||
+
|
|
||||||
+datas_lib = \
|
|
||||||
+ fonetree.dat
|
|
||||||
+
|
|
||||||
generated_header = $(top_builddir)/src/chewing-definition.h
|
|
||||||
|
|
||||||
all: checkdata_stamp gendata_stamp
|
|
||||||
@@ -37,4 +40,8 @@ install-data-local: $(datas) pinyin.tab
|
|
||||||
$(mkinstalldirs) $(DESTDIR)/$(datadir)/chewing
|
|
||||||
$(INSTALL_DATA) $(datas) pinyin.tab swkb.dat symbols.dat \
|
|
||||||
$(DESTDIR)/$(datadir)/chewing
|
|
||||||
-CLEANFILES = $(datas) gendata_stamp checkdata_stamp $(generated_header)
|
|
||||||
+ $(mkinstalldirs) $(DESTDIR)/$(libdir)/chewing
|
|
||||||
+ $(INSTALL_DATA) $(datas_lib) \
|
|
||||||
+ $(DESTDIR)/$(libdir)/chewing
|
|
||||||
+
|
|
||||||
+CLEANFILES = $(datas) $(datas_lib) gendata_stamp checkdata_stamp $(generated_header)
|
|
||||||
diff -up ./src/Makefile.am.bz477690 ./src/Makefile.am
|
|
||||||
--- ./src/Makefile.am.bz477690 2008-12-02 00:29:20.000000000 +1000
|
|
||||||
+++ ./src/Makefile.am 2009-05-20 14:24:31.000000000 +1000
|
|
||||||
@@ -3,6 +3,7 @@ INCLUDES = \
|
|
||||||
-I$(top_srcdir)/include \
|
|
||||||
-I$(top_srcdir)/include/internal \
|
|
||||||
-I$(top_srcdir)/src/porting_layer/include \
|
|
||||||
+ -DLIBINSTDIR=\"$(libdir)\"\
|
|
||||||
-DCHEWING_DATADIR=\"$(datadir)/chewing\"
|
|
||||||
|
|
||||||
lib_LTLIBRARIES = libchewing.la
|
|
||||||
diff -up ./src/tree.c.bz477690 ./src/tree.c
|
|
||||||
--- ./src/tree.c.bz477690 2008-12-02 00:29:20.000000000 +1000
|
|
||||||
+++ ./src/tree.c 2009-05-20 14:24:31.000000000 +1000
|
|
||||||
@@ -114,7 +114,8 @@ void InitTree( const char *prefix )
|
|
||||||
int i;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
- sprintf( filename, "%s" PLAT_SEPARATOR "%s", prefix, PHONE_TREE_FILE );
|
|
||||||
+ sprintf( filename, "%s" PLAT_SEPARATOR "chewing" PLAT_SEPARATOR "%s",
|
|
||||||
+ LIBINSTDIR, PHONE_TREE_FILE );
|
|
||||||
#ifdef USE_BINARY_DATA
|
|
||||||
plat_mmap_set_invalid( &tree_mmap );
|
|
||||||
tree_size = plat_mmap_create( &tree_mmap, filename, FLAG_ATTRIBUTE_READ );
|
|
@ -1,12 +0,0 @@
|
|||||||
diff -up ./src/mod_aux.c.chewing_zuin ./src/mod_aux.c
|
|
||||||
--- ./src/mod_aux.c.chewing_zuin 2009-09-30 11:11:56.000000000 +1000
|
|
||||||
+++ ./src/mod_aux.c 2009-09-30 11:20:31.000000000 +1000
|
|
||||||
@@ -90,7 +90,7 @@ CHEWING_API char *chewing_zuin_String( C
|
|
||||||
if ( ctx->output->zuinBuf[ i ].s[ 0 ] != '\0' ) {
|
|
||||||
strcat( s, (char *) (ctx->output->zuinBuf[ i ].s) );
|
|
||||||
if ( zuin_count )
|
|
||||||
- *zuin_count++;
|
|
||||||
+ (*zuin_count)++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return s;
|
|
@ -1,29 +0,0 @@
|
|||||||
diff -up ./src/zuin.c.hsu ./src/zuin.c
|
|
||||||
--- ./src/zuin.c.hsu 2008-12-02 00:29:20.000000000 +1000
|
|
||||||
+++ ./src/zuin.c 2010-03-04 16:43:23.000000000 +1000
|
|
||||||
@@ -183,11 +178,8 @@ static int HsuPhoInput( ZuinData *pZuin,
|
|
||||||
{
|
|
||||||
int type = 0, searchTimes = 0, inx = 0;
|
|
||||||
|
|
||||||
- if (
|
|
||||||
- ( IsHsuPhoEndKey( pZuin->pho_inx, key ) &&
|
|
||||||
- ( pZuin->kbtype == KB_HSU ) ) ||
|
|
||||||
- ( IsDvorakHsuPhoEndKey( pZuin->pho_inx, key ) &&
|
|
||||||
- ( pZuin->kbtype == KB_DVORAK_HSU ) ) ) {
|
|
||||||
+ /* Dvorak Hsu key has already converted to Hsu */
|
|
||||||
+ if ( IsHsuPhoEndKey( pZuin->pho_inx, key )){
|
|
||||||
if ( pZuin->pho_inx[ 1 ] == 0 && pZuin->pho_inx[ 2 ] == 0 ) {
|
|
||||||
/* convert "ㄐㄑㄒ" to "ㄓㄔㄕ" */
|
|
||||||
if ( 12 <= pZuin->pho_inx[ 0 ] && pZuin->pho_inx[ 0 ] <= 14 ) {
|
|
||||||
@@ -232,10 +224,7 @@ static int HsuPhoInput( ZuinData *pZuin,
|
|
||||||
pZuin->pho_inx[ 0 ] = 12;
|
|
||||||
}
|
|
||||||
|
|
||||||
- if ( pZuin->kbtype == KB_HSU )
|
|
||||||
- searchTimes = ( key == 'j' ) ? 3 : 2;
|
|
||||||
- else if ( pZuin->kbtype == KB_DVORAK_HSU )
|
|
||||||
- searchTimes = ( key == 'h' || key == 'n' ) ? 3 : 2 ;
|
|
||||||
+ searchTimes = ( key == 'j' ) ? 3 : 2;
|
|
||||||
|
|
||||||
return EndKeyProcess( pZuin, key, searchTimes );
|
|
||||||
}
|
|
@ -1,238 +0,0 @@
|
|||||||
diff -up ./src/chewingio.c.phraseChoiceRearward ./src/chewingio.c
|
|
||||||
--- ./src/chewingio.c.phraseChoiceRearward 2008-12-02 00:29:20.000000000 +1000
|
|
||||||
+++ ./src/chewingio.c 2010-02-02 15:17:13.000000000 +1000
|
|
||||||
@@ -20,6 +20,7 @@
|
|
||||||
#include <string.h>
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
+#include <stdio.h>
|
|
||||||
|
|
||||||
#include "chewing-utf8-util.h"
|
|
||||||
#include "global.h"
|
|
||||||
@@ -100,6 +101,31 @@ int addTerminateService( void (*callback
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
+static void chooseCandidate( ChewingContext *ctx, int toSelect, int key_buf_cursor )
|
|
||||||
+{
|
|
||||||
+ ChewingData *pgdata = ctx->data;
|
|
||||||
+ if ( toSelect ) {
|
|
||||||
+ if( ! pgdata->bSelect ) {
|
|
||||||
+ ChoiceFirstAvail( pgdata );
|
|
||||||
+ } else {
|
|
||||||
+ if ( pgdata->config.bPhraseChoiceRearward ){
|
|
||||||
+ int avail_willbe=(pgdata->availInfo.currentAvail > 0)?
|
|
||||||
+ pgdata->availInfo.currentAvail-1: pgdata->availInfo.nAvail - 1;
|
|
||||||
+ pgdata->chiSymbolCursor=pgdata->choiceInfo.oldChiSymbolCursor
|
|
||||||
+ - pgdata->availInfo.avail[avail_willbe].len;
|
|
||||||
+ if (chewing_buffer_Len(ctx) > pgdata->choiceInfo.oldChiSymbolCursor){
|
|
||||||
+ pgdata->chiSymbolCursor++;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ ChoiceNextAvail( pgdata );
|
|
||||||
+ }
|
|
||||||
+ } else if ( pgdata->symbolKeyBuf[ key_buf_cursor ] ) {
|
|
||||||
+ /* Open Symbol Choice List */
|
|
||||||
+ if( ! pgdata->choiceInfo.isSymbol )
|
|
||||||
+ OpenSymbolChoice( pgdata );
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
CHEWING_API ChewingContext *chewing_new()
|
|
||||||
{
|
|
||||||
ChewingContext *ctx;
|
|
||||||
@@ -556,17 +582,7 @@ CHEWING_API int chewing_handle_Space( Ch
|
|
||||||
if ( ChewingIsChiAt( key_buf_cursor, pgdata ) )
|
|
||||||
toSelect = 1;
|
|
||||||
|
|
||||||
- if ( toSelect ) {
|
|
||||||
- if ( ! pgdata->bSelect )
|
|
||||||
- ChoiceFirstAvail( pgdata );
|
|
||||||
- else
|
|
||||||
- ChoiceNextAvail( pgdata );
|
|
||||||
- }
|
|
||||||
- else if ( pgdata->symbolKeyBuf[ key_buf_cursor ] ) {
|
|
||||||
- /* Open Symbol Choice List */
|
|
||||||
- if( ! pgdata->choiceInfo.isSymbol )
|
|
||||||
- OpenSymbolChoice( pgdata );
|
|
||||||
- }
|
|
||||||
+ chooseCandidate( ctx, toSelect, key_buf_cursor );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -753,22 +769,10 @@ CHEWING_API int chewing_handle_Down( Che
|
|
||||||
|
|
||||||
/* see if to select */
|
|
||||||
if ( ChewingIsChiAt( key_buf_cursor, pgdata ) )
|
|
||||||
- toSelect = 1;
|
|
||||||
-
|
|
||||||
- if ( toSelect ) {
|
|
||||||
- if( ! pgdata->bSelect ) {
|
|
||||||
- ChoiceFirstAvail( pgdata );
|
|
||||||
- }
|
|
||||||
- else {
|
|
||||||
- ChoiceNextAvail( pgdata );
|
|
||||||
- }
|
|
||||||
- }
|
|
||||||
- else if ( pgdata->symbolKeyBuf[ key_buf_cursor ] ) {
|
|
||||||
- /* Open Symbol Choice List */
|
|
||||||
- if ( ! pgdata->choiceInfo.isSymbol )
|
|
||||||
- OpenSymbolChoice( pgdata );
|
|
||||||
- }
|
|
||||||
+ toSelect = 1;
|
|
||||||
|
|
||||||
+ chooseCandidate( ctx, toSelect, key_buf_cursor );
|
|
||||||
+
|
|
||||||
MakeOutputWithRtn( pgo, pgdata, keystrokeRtn );
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
diff -up ./src/choice.c.phraseChoiceRearward ./src/choice.c
|
|
||||||
--- ./src/choice.c.phraseChoiceRearward 2008-12-02 00:29:20.000000000 +1000
|
|
||||||
+++ ./src/choice.c 2010-02-02 15:18:02.000000000 +1000
|
|
||||||
@@ -71,22 +71,44 @@ static void ChangeSelectIntervalAndBreak
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @brief Loading all possible phrases after the cursor from long to short into AvailInfo structure.*/
|
|
||||||
-static void SetAvailInfo(
|
|
||||||
- AvailInfo *pai, const uint16 phoneSeq[],
|
|
||||||
- int nPhoneSeq, int begin, const int bSymbolArrBrkpt[] )
|
|
||||||
+static void SetAvailInfo(
|
|
||||||
+ AvailInfo *pai, const uint16 phoneSeq[],
|
|
||||||
+ int nPhoneSeq, int begin, const int bSymbolArrBrkpt[],
|
|
||||||
+ ChewingData *pgdata,int end)
|
|
||||||
{
|
|
||||||
- int end, pho_id;
|
|
||||||
+ int pho_id;
|
|
||||||
int diff;
|
|
||||||
uint16 userPhoneSeq[ MAX_PHONE_SEQ_LEN ];
|
|
||||||
|
|
||||||
pai->nAvail = 0;
|
|
||||||
|
|
||||||
- for ( end = begin; end < nPhoneSeq; end++ ) {
|
|
||||||
- diff = end - begin;
|
|
||||||
- if ( diff > 0 && bSymbolArrBrkpt[ end ] )
|
|
||||||
- break;
|
|
||||||
+ int i,head,head_tmp;
|
|
||||||
+ if ( pgdata->config.bPhraseChoiceRearward ){
|
|
||||||
+ for (i=end;i>=begin;i--){
|
|
||||||
+ head=i;
|
|
||||||
+ if(bSymbolArrBrkpt[i])
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
+ head_tmp=end;
|
|
||||||
+ }else{
|
|
||||||
+ head_tmp=head=begin;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ int tail,tail_tmp;
|
|
||||||
+ if ( pgdata->config.bPhraseChoiceRearward ){
|
|
||||||
+ tail_tmp=tail=end;
|
|
||||||
+ }else{
|
|
||||||
+ for (i=begin;i<nPhoneSeq;i++){
|
|
||||||
+ if(bSymbolArrBrkpt[i])
|
|
||||||
+ break;
|
|
||||||
+ tail=i;
|
|
||||||
+ }
|
|
||||||
+ tail_tmp=begin;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
- pho_id = TreeFindPhrase( begin, end, phoneSeq );
|
|
||||||
+ while(head<=head_tmp && tail_tmp<=tail){
|
|
||||||
+ diff = tail_tmp - head_tmp;
|
|
||||||
+ pho_id = TreeFindPhrase( head_tmp, tail_tmp, phoneSeq );
|
|
||||||
if ( pho_id != -1 ) {
|
|
||||||
/* save it! */
|
|
||||||
pai->avail[ pai->nAvail ].len = diff + 1;
|
|
||||||
@@ -95,8 +117,8 @@ static void SetAvailInfo(
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
memcpy(
|
|
||||||
- userPhoneSeq,
|
|
||||||
- &phoneSeq[ begin ],
|
|
||||||
+ userPhoneSeq,
|
|
||||||
+ &phoneSeq[ head_tmp ],
|
|
||||||
sizeof( uint16 ) * ( diff + 1 ) ) ;
|
|
||||||
userPhoneSeq[ diff + 1 ] = 0;
|
|
||||||
if ( UserGetPhraseFirst( userPhoneSeq ) ) {
|
|
||||||
@@ -109,6 +131,12 @@ static void SetAvailInfo(
|
|
||||||
pai->avail[ pai->nAvail ].id = -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+ if ( pgdata->config.bPhraseChoiceRearward ){
|
|
||||||
+ head_tmp--;
|
|
||||||
+ }else{
|
|
||||||
+ tail_tmp++;
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -208,6 +236,21 @@ static void SetChoiceInfo(
|
|
||||||
pci->pageNo = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
+/*
|
|
||||||
+ * Seek the start of the phrase (eng chars are skipped)
|
|
||||||
+ */
|
|
||||||
+static int SeekPhraseHead( ChewingData *pgdata ){
|
|
||||||
+ int i;
|
|
||||||
+ int phoneSeq=PhoneSeqCursor( pgdata );
|
|
||||||
+ for(i=pgdata->nPrefer-1; i>=0; i--){
|
|
||||||
+ if (pgdata->preferInterval[ i ].from > phoneSeq
|
|
||||||
+ || pgdata->preferInterval[ i ].to < phoneSeq )
|
|
||||||
+ continue;
|
|
||||||
+ return pgdata->preferInterval[ i ].from;
|
|
||||||
+ }
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
/** @brief Enter choice mode and relating initialisations. */
|
|
||||||
int ChoiceFirstAvail( ChewingData *pgdata )
|
|
||||||
{
|
|
||||||
@@ -216,30 +259,32 @@ int ChoiceFirstAvail( ChewingData *pgdat
|
|
||||||
|
|
||||||
/* see if there is some word in the cursor position */
|
|
||||||
if ( pgdata->chiSymbolBufLen == pgdata->chiSymbolCursor ) {
|
|
||||||
- if ( pgdata->config.bPhraseChoiceRearward )
|
|
||||||
- pgdata->chiSymbolCursor = pgdata->preferInterval[ pgdata->nPrefer - 1 ].from + CountSymbols( pgdata, pgdata->chiSymbolBufLen );
|
|
||||||
- else
|
|
||||||
- pgdata->chiSymbolCursor--;
|
|
||||||
+ pgdata->chiSymbolCursor--;
|
|
||||||
}
|
|
||||||
+ int end=PhoneSeqCursor( pgdata );
|
|
||||||
+ if ( pgdata->config.bPhraseChoiceRearward ){
|
|
||||||
+ pgdata->chiSymbolCursor = SeekPhraseHead(pgdata)+ CountSymbols( pgdata, pgdata->chiSymbolCursor );
|
|
||||||
+ }
|
|
||||||
+ int begin=PhoneSeqCursor( pgdata );
|
|
||||||
|
|
||||||
pgdata->bSelect = 1;
|
|
||||||
-
|
|
||||||
- SetAvailInfo(
|
|
||||||
- &( pgdata->availInfo ),
|
|
||||||
- pgdata->phoneSeq,
|
|
||||||
+ SetAvailInfo(
|
|
||||||
+ &( pgdata->availInfo ),
|
|
||||||
+ pgdata->phoneSeq,
|
|
||||||
pgdata->nPhoneSeq,
|
|
||||||
- PhoneSeqCursor( pgdata ),
|
|
||||||
- pgdata->bSymbolArrBrkpt );
|
|
||||||
+ begin,
|
|
||||||
+ pgdata->bSymbolArrBrkpt,
|
|
||||||
+ pgdata,end);
|
|
||||||
|
|
||||||
if ( ! pgdata->availInfo.nAvail )
|
|
||||||
return ChoiceEndChoice( pgdata );
|
|
||||||
|
|
||||||
pgdata->availInfo.currentAvail = pgdata->availInfo.nAvail - 1;
|
|
||||||
SetChoiceInfo(
|
|
||||||
- &( pgdata->choiceInfo ),
|
|
||||||
- &( pgdata->availInfo ),
|
|
||||||
- pgdata->phoneSeq,
|
|
||||||
- PhoneSeqCursor( pgdata ),
|
|
||||||
+ &( pgdata->choiceInfo ),
|
|
||||||
+ &( pgdata->availInfo ),
|
|
||||||
+ pgdata->phoneSeq,
|
|
||||||
+ PhoneSeqCursor( pgdata ),
|
|
||||||
pgdata->config.candPerPage );
|
|
||||||
return 0;
|
|
||||||
}
|
|
Loading…
Reference in new issue