rpms/libchewing/devel libchewing-0.3.2.hsu.patch, NONE, 1.1 import.log, 1.18, 1.19 libchewing.spec, 1.41, 1.42

Ding-Yi Chen dchen at fedoraproject.org
Wed Feb 10 23:13:56 UTC 2010


Author: dchen

Update of /cvs/pkgs/rpms/libchewing/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv6045/devel

Modified Files:
	import.log libchewing.spec 
Added Files:
	libchewing-0.3.2.hsu.patch 
Log Message:
Fix Hsu and Dvorak Hsu input

libchewing-0.3.2.hsu.patch:
 chewingio.c      |    2 -
 choice.c         |   88 ++++++++++++++++++++++++++++++++++++++++++++++---------
 common/key2pho.c |    2 -
 zuin.c           |   23 +++++---------
 4 files changed, 86 insertions(+), 29 deletions(-)

--- NEW FILE libchewing-0.3.2.hsu.patch ---
diff -up ./src/chewingio.c.hsu ./src/chewingio.c
--- ./src/chewingio.c.hsu	2010-02-10 14:01:42.000000000 +1000
+++ ./src/chewingio.c	2010-02-10 14:01:42.000000000 +1000
@@ -1053,7 +1053,7 @@ static int dvorak_convert( int key )
 		';',':','q','Q','j','J','k','K','x','X','b','B','m','M',
 		'w','W','v','V','z','Z'};
 	char qkey[] = {
-		'Q','q','w','W','e','E','r','R','t','T','y','Y','u','U',
+		'q','Q','w','W','e','E','r','R','t','T','y','Y','u','U',
 		'i','I','o','O','p','P','[','{',']','}','\\','|',
 		'a','A','s','S','d','D','f','F','g','G','h','H','j','J',
 		'k','K','l','L',';',':','\'','\"',
diff -up ./src/choice.c.hsu ./src/choice.c
--- ./src/choice.c.hsu	2010-02-10 14:01:42.000000000 +1000
+++ ./src/choice.c	2010-02-10 16:12:04.000000000 +1000
@@ -29,6 +29,7 @@
 #include "tree-private.h"
 #include "userphrase-private.h"
 #include "private.h"
+#include "zuin-private.h"
 
 #define CEIL_DIV( a, b ) 	( ( a + b - 1 ) / b )
 
@@ -151,6 +152,23 @@ static int ChoiceTheSame( ChoiceInfo *pc
 	return 0;
 }
 
+static void ChoiceInfoAppendChi(
+		ChoiceInfo *pci, uint16 phone )
+{
+	Word tempWord;
+	GetCharFirst( &tempWord, phone );
+	do {
+		if ( ChoiceTheSame( pci, tempWord.word, ueBytesFromChar( tempWord.word[0] ) * sizeof( char ) ) ) 
+			continue;
+		memcpy( 
+			pci->totalChoiceStr[ pci->nTotalChoice ],
+			tempWord.word, ueBytesFromChar( tempWord.word[0] ) * sizeof( char ) );
+		assert(pci->nTotalChoice <= MAX_CHOICE);
+		pci->totalChoiceStr[ pci->nTotalChoice ][ ueBytesFromChar( tempWord.word[0] ) ] = '\0';
+		pci->nTotalChoice++;
+	} while( GetCharNext( &tempWord ) );
+}
+
 /** @brief Loading all possible phrases of certain length.
  *
  *	   Loading all possible phrases of certain length into ChoiceInfo structure from static
@@ -158,10 +176,10 @@ static int ChoiceTheSame( ChoiceInfo *pc
  *	   including number of total pages and the number of current page.\n
  */
 static void SetChoiceInfo(
+		ChewingData *pgdata,
 		ChoiceInfo *pci,AvailInfo *pai, uint16 *phoneSeq, int cursor,
 		int candPerPage )
 {
-	Word tempWord;
 	Phrase tempPhrase;
 	int len;
 	UserPhraseData *pUserPhraseData;
@@ -176,17 +194,57 @@ static void SetChoiceInfo(
 
 	/* secondly, read tree phrase */
 	if ( len == 1 ) { /* single character */
-		GetCharFirst( &tempWord, phoneSeq[ cursor ] );
-		do {
-			if ( ChoiceTheSame( pci, tempWord.word, ueBytesFromChar( tempWord.word[0] ) * sizeof( char ) ) ) 
-				continue;
-			memcpy( 
-				pci->totalChoiceStr[ pci->nTotalChoice ],
-				tempWord.word, ueBytesFromChar( tempWord.word[0] ) * sizeof( char ) );
-			assert(pci->nTotalChoice <= MAX_CHOICE);
-			pci->totalChoiceStr[ pci->nTotalChoice ][ ueBytesFromChar( tempWord.word[0] ) ] = '\0';
-			pci->nTotalChoice++;
-		} while( GetCharNext( &tempWord ) );
+		ChoiceInfoAppendChi( pci, phoneSeq[cursor] );
+		if (pgdata->zuinData.kbtype == KB_HSU || pgdata->zuinData.kbtype == KB_DVORAK_HSU ){
+			switch(phoneSeq[ cursor ]){
+				case 0x2800: // 'ㄘ'
+					ChoiceInfoAppendChi( pci, 0x30 );  // 'ㄟ'
+					break;
+				case 0x80: // 'ㄧ'
+					ChoiceInfoAppendChi( pci, 0x20 );  // 'ㄝ'
+					break;
+				case 0x2A00: // 'ㄙ'
+					ChoiceInfoAppendChi( pci, 0x1 );  // '˙'
+					break;
+				case 0xA00: // 'ㄉ'
+					ChoiceInfoAppendChi( pci, 0x2 );  // 'ˊ'
+					break;
+				case 0x800: // 'ㄈ'
+					ChoiceInfoAppendChi( pci, 0x3 );  // 'ˇ'
+					break;
+				case 0x18: // 'ㄜ'
+					ChoiceInfoAppendChi( pci, 0x1200 );  // 'ㄍ'
+					break;
+				case 0x10: // 'ㄛ'
+					ChoiceInfoAppendChi( pci, 0x1600 );  // 'ㄏ'
+					break;
+				case 0x1E00: // 'ㄓ'
+					ChoiceInfoAppendChi( pci, 0x1800 );  // 'ㄐ'
+					ChoiceInfoAppendChi( pci, 0x4 );  // 'ˋ'
+					break;
+				case 0x58: // 'ㄤ'
+					ChoiceInfoAppendChi( pci, 0x1400 );  // 'ㄎ'
+					break;
+				case 0x68: // 'ㄦ'
+					ChoiceInfoAppendChi( pci, 0x1000 );  // 'ㄌ'
+					ChoiceInfoAppendChi( pci, 0x60 );  // 'ㄥ'
+					break;
+				case 0x2200: // 'ㄕ'
+					ChoiceInfoAppendChi( pci, 0x1C00 );  // 'ㄒ'
+					break;
+				case 0x2000: // 'ㄔ'
+					ChoiceInfoAppendChi( pci, 0x1A00 );  // 'ㄑ'
+					break;
+				case 0x50: // 'ㄣ'
+					ChoiceInfoAppendChi( pci, 0xE00 );  // 'ㄋ'
+					break;
+				case 0x48: // 'ㄢ'
+					ChoiceInfoAppendChi( pci, 0x600 );  // 'ㄇ'
+					break;
+				default:
+					break;
+			}
+		}
 	}
 	/* phrase */
 	else {
@@ -281,6 +339,7 @@ int ChoiceFirstAvail( ChewingData *pgdat
 
 	pgdata->availInfo.currentAvail = pgdata->availInfo.nAvail - 1;
 	SetChoiceInfo(
+		pgdata,
 		&( pgdata->choiceInfo ),
 		&( pgdata->availInfo ),
 		pgdata->phoneSeq,
@@ -289,12 +348,14 @@ int ChoiceFirstAvail( ChewingData *pgdat
 	return 0;
 }
 
-int ChoicePrevAvail( ChewingData *pgdata )
+int ChoicePrevAvail( ChewingContext *ctx )
 {
+	ChewingData *pgdata=ctx->data;
 	if (pgdata->choiceInfo.isSymbol) return 0;
 	if ( ++( pgdata->availInfo.currentAvail ) >= pgdata->availInfo.nAvail )
 		pgdata->availInfo.currentAvail = 0;
 	SetChoiceInfo( 
+		pgdata,
 		&( pgdata->choiceInfo ), 
 		&( pgdata->availInfo ), 
 		pgdata->phoneSeq, 
@@ -310,6 +371,7 @@ int ChoiceNextAvail( ChewingData *pgdata
 	if ( --( pgdata->availInfo.currentAvail ) < 0 )
 		pgdata->availInfo.currentAvail = pgdata->availInfo.nAvail - 1;
 	SetChoiceInfo(
+		pgdata,
 		&( pgdata->choiceInfo ), 
 		&( pgdata->availInfo ), 
 		pgdata->phoneSeq,
diff -up ./src/common/key2pho.c.hsu ./src/common/key2pho.c
--- ./src/common/key2pho.c.hsu	2008-12-02 00:29:20.000000000 +1000
+++ ./src/common/key2pho.c	2010-02-10 14:01:42.000000000 +1000
@@ -81,7 +81,7 @@ static char *key_str[ MAX_KBTYPE ] = {
 	 "bpmfdtnlvkhg7c,./j;'sexuaorwiqzy890-=1234",		/* ET  */
 	 "bpmfdtnlvkhgvcgycjqwsexuaorwiqzpmntlhdfjk",		/* ET26 */
 	 "1'a;2,oq.ejpuk5yixfdbghm8ctw9rnv0lsz[7634",		/* Dvorak */
-	 "bpmfdtnlgkhjvcjvcrzasexuyhgeiawomnklldhtn",		/* Dvorak Hsu */
+	 "bpmfdtnlgkhjvcjvcrzasexuyhgeiawomnkllsdfj",		/* Dvorak Hsu */
 	 "qqazwwsxedcrfvttgbyhnujmuikbiolmoplnpyerd",		/* DACHEN-CP26 */
 	 "1qaz2wsxedcrfv5tgbyhnujm8ik,9ol.0p;/-7634",		/* pinyin */
 } ;
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-02-10 14:01:42.000000000 +1000
@@ -31,20 +31,6 @@
 #include "hanyupinyin-private.h"
 #include "private.h"
 
-static int IsDvorakHsuPhoEndKey( int pho_inx[], int key )
-{
-	switch ( key ) {
-		case 'd':
-		case 'h':
-		case 't':
-		case 'n':
-		case ' ':
-			return ( pho_inx[ 0 ] || pho_inx[ 1 ] || pho_inx[ 2 ] );
-		default:
-			return 0;
-	}
-}
-
 /*
  * process a key input
  * return value:
@@ -67,6 +53,15 @@ static int IsHsuPhoEndKey( int pho_inx[]
 	}
 }
 
+static int IsDvorakHsuPhoEndKey( int pho_inx[], int key )
+{
+	/* DvorakHsu tone mark should be same with Hsu's mark 
+           After conversion. */
+	return IsHsuPhoEndKey(pho_inx, key);
+}
+
+
+
 /* copy the idea from HSU keyboard */
 static int IsET26PhoEndKey( int pho_inx[], int key )
 {


Index: import.log
===================================================================
RCS file: /cvs/pkgs/rpms/libchewing/devel/import.log,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -p -r1.18 -r1.19
--- import.log	2 Feb 2010 05:29:53 -0000	1.18
+++ import.log	10 Feb 2010 23:13:55 -0000	1.19
@@ -16,3 +16,4 @@ libchewing-0_3_2-15_fc11:HEAD:libchewing
 libchewing-0_3_2-16_fc11:HEAD:libchewing-0.3.2-16.fc11.src.rpm:1254274732
 libchewing-0_3_2-17_fc12:HEAD:libchewing-0.3.2-17.fc12.src.rpm:1262678096
 libchewing-0_3_2-21_fc12:HEAD:libchewing-0.3.2-21.fc12.src.rpm:1265088570
+libchewing-0_3_2-22_fc12:HEAD:libchewing-0.3.2-22.fc12.src.rpm:1265843616


Index: libchewing.spec
===================================================================
RCS file: /cvs/pkgs/rpms/libchewing/devel/libchewing.spec,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -p -r1.41 -r1.42
--- libchewing.spec	2 Feb 2010 05:29:53 -0000	1.41
+++ libchewing.spec	10 Feb 2010 23:13:56 -0000	1.42
@@ -2,7 +2,7 @@
 %define name_zh_TW %{im_name_zh_TW}函式庫
 Name:           libchewing
 Version:        0.3.2
-Release:        21%{?dist}
+Release:        22%{?dist}
 Summary:        Intelligent phonetic input method library for Traditional Chinese
 Summary(zh_TW): %{name_zh_TW}
 
@@ -22,6 +22,7 @@ Source:         http://chewing.csie.net/
 Patch9: libchewing-0.3.2.bz477690.patch
 Patch10: libchewing-0.3.2.phraseChoiceRearward.2.patch
 Patch11: libchewing-0.3.2.chewing_zuin.patch
+Patch12: libchewing-0.3.2.hsu.patch
 
 %{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
 %define libchewing_python_dir %{python_sitearch}/%{name}
@@ -85,6 +86,7 @@ Python binding of libchewing.
 %patch9 -p0 -b .bz477690
 %patch10 -p0 -b .phraseChoiceRearward
 %patch11 -p0 -b .chewing_zuin
+%patch12 -p0 -b .hsu
 
 %build
 export CFLAGS=-DLIBINSTDIR='\"%{_libdir}\" -g'
@@ -130,6 +132,10 @@ rm -rf $RPM_BUILD_ROOT
 
 
 %changelog
+* Wed Feb 10 2010 Ding-Yi Chen <dchen at redhat dot com> - 0.3.2-22
+- Fix Hsu and Dvorak Hsu input (ibus google issue 755)
+- Resolves: #555192
+
 * Tue Feb 02 2010 Ding-Yi Chen <dchen at redhat dot com> - 0.3.2-21
 - Revised phrase choice from rear logic.
   Thus update phraseChoiceRearward.patch as phraseChoiceRearward.2.patch



More information about the scm-commits mailing list