1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106
|
Description: Debian changes before version 3.0.4+dfsg1-1, to be split some day
Forwarded: not-needed
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,10 +1,10 @@
prefix=@prefix@
all:
- cd unikey; make
- cd fonts; make
+# cd unikey; make
+# cd fonts; make
cd unicon; make
- cd tools; make
- cd unimap; make
+# cd tools; make
+# cd unimap; make
data:
cd unicon; make data
@@ -17,26 +17,26 @@
if [ ! -d $(prefix)/lib/unicon ] ; then mkdir -p $(prefix)/lib/unicon; fi
if [ ! -d $(prefix)/bin ] ; then mkdir -p $(prefix)/bin; fi
cd unicon; make install
- cd unikey; make install
- cd fonts; make install
- cd tools; make install
- cd unimap; make install
+# cd unikey; make install
+# cd fonts; make install
+# cd tools; make install
+# cd unimap; make install
clean:
cd unicon; make clean
- cd unikey; make clean
- cd fonts; make clean
- cd tools; make clean
- cd unimap; make clean
+# cd unikey; make clean
+# cd fonts; make clean
+# cd tools; make clean
+# cd unimap; make clean
rm -f core *.bak *~
distclean: clean
rm -f config.status config.log config.cache Makefile
cd unicon; make distclean
- cd unikey; make distclean
- cd fonts; make distclean
- cd tools; make distclean
- cd sfonts; make distclean
- cd unimap; make distclean
+# cd unikey; make distclean
+# cd fonts; make distclean
+# cd tools; make distclean
+# cd sfonts; make distclean
+# cd unimap; make distclean
rm -f *.bak
--- a/fonts/big5/Makefile.in
+++ b/fonts/big5/Makefile.in
@@ -2,6 +2,7 @@
CFLAGS = @CFLAGS@
CFLAGS += -I/usr/src/linux/include -I. -include /usr/src/linux/include/linux/modversions.h
PROG = encode-big5.o
+DESTDIR=
KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
--- a/fonts/gb/Makefile.in
+++ b/fonts/gb/Makefile.in
@@ -2,6 +2,7 @@
CFLAGS = @CFLAGS@
CFLAGS += -I/usr/src/linux/include -I. -include /usr/src/linux/include/linux/modversions.h
PROG = encode-gb.o
+DESTDIR =
CC=gcc $(CFLAGS)
MODCFLAGS = -Wall -O2 -DMODULE -D__KERNEL__ -DLINUX
--- a/fonts/gbk/Makefile.in
+++ b/fonts/gbk/Makefile.in
@@ -2,6 +2,7 @@
CFLAGS = @CFLAGS@
CFLAGS += -I/usr/src/linux/include -I. -include /usr/src/linux/include/linux/modversions.h
PROG = encode-gbk.o
+DESTDIR =
CC=gcc $(CFLAGS)
MODCFLAGS = -Wall -O2 -DMODULE -D__KERNEL__ -DLINUX
--- a/fonts/jis/Makefile.in
+++ b/fonts/jis/Makefile.in
@@ -2,6 +2,7 @@
CFLAGS = @CFLAGS@
CFLAGS += -I/usr/src/linux/include -I. -include /usr/src/linux/include/linux/modversions.h
PROG = encode-jis.o
+DESTDIR =
CC=gcc $(CFLAGS)
MODCFLAGS = -Wall -O2 -DMODULE -D__KERNEL__ -DLINUX
--- a/fonts/kscm/Makefile.in
+++ b/fonts/kscm/Makefile.in
@@ -2,6 +2,7 @@
CFLAGS = @CFLAGS@
CFLAGS += -I/usr/src/linux/include -I. -include /usr/src/linux/include/linux/modversions.h
PROG = encode-kscm.o
+DESTDIR =
CC=gcc $(CFLAGS)
MODCFLAGS = -Wall -O2 -DMODULE -D__KERNEL__ -DLINUX
--- a/unicon/ImmModules/cce/CCE_pinyin.c
+++ b/unicon/ImmModules/cce/CCE_pinyin.c
@@ -44,6 +44,8 @@
extern void CCE_ClosePinyin (InputModule * p);
extern InputModule *pCCE_OpenPinyin (char *szPath);
extern void Pinyin_SaveAllPyUsrPhrase ();
+extern int SaveUsrPhrase(char *pathname);
+extern int SavePhraseFrequencyi(char *pathname);
static void
SetPhraseBuffer (PhraseItem * p, char *buf, int buflen)
@@ -156,6 +158,12 @@
static int
IMM_Flush ()
{
+ char name[256];
+ snprintf(name,sizeof(name)-1,"%s/.pyinput/usrphrase.tab",getenv("HOME"));
+ SaveUsrPhrase(name);
+ snprintf(name,sizeof(name)-1,"%s/.pyinput/sysfrequency.tab",getenv("HOME"));
+ SavePhraseFrequency(name);
+
return 1;
}
--- a/unicon/ImmModules/cce/Makefile.in
+++ b/unicon/ImmModules/cce/Makefile.in
@@ -6,7 +6,7 @@
CCE_OBJS = xl_hzinput.o CCE_hzinput.o intcode.o \
xl_pinyin.o CCE_pinyin.o
-CFLAGS = -g -O2 -fomit-frame-pointer -W -Wall -I. -I../../include
+CFLAGS = -fPIC -g -O2 -fomit-frame-pointer -W -Wall -I. -I../../include
all: cce_hzinput.so cce_pinyin.so gb18030_intcode.so
@@ -15,19 +15,19 @@
xl_hzinput.o : xl_hzinput.c
gcc $(CFLAGS) -c xl_hzinput.c -o xl_hzinput.o
cce_hzinput.so: CCE_hzinput.o xl_hzinput.o
- gcc CCE_hzinput.o xl_hzinput.o -shared -o cce_hzinput.so
+ gcc CCE_hzinput.o xl_hzinput.o -fPIC -shared -o cce_hzinput.so $(LDFLAGS)
xl_pinyin.o : xl_pinyin.c xl_pinyin.h
gcc $(CFLAGS) -c xl_pinyin.c -o xl_pinyin.o
CCE_pinyin.o : CCE_pinyin.c
gcc $(CFLAGS) -c CCE_pinyin.c -o CCE_pinyin.o
cce_pinyin.so : xl_pinyin.o CCE_pinyin.o
- gcc CCE_pinyin.o xl_pinyin.o -shared -o cce_pinyin.so
+ gcc CCE_pinyin.o xl_pinyin.o -fPIC -shared -o cce_pinyin.so $(LDFLAGS)
intcode.o : xl_intcode.c
gcc $(CFLAGS) -c xl_intcode.c -o intcode.o
gb18030_intcode.so : intcode.o
- gcc intcode.o -shared -o gb18030_intcode.so
+ gcc intcode.o -shared -o gb18030_intcode.so $(LDFLAGS)
test: hzinput_test intcode_test
--- a/unicon/ImmModules/cce/inputs/Makefile.in
+++ b/unicon/ImmModules/cce/inputs/Makefile.in
@@ -2,10 +2,10 @@
prefix=@prefix@
CFLAGS = @CFLAGS@
-CFLAGS += -I. -I..
+CFLAGS += -O2 -I. -I..
LIBDIR = $(prefix)/lib/unicon
-LD = gcc $(CFLAGS)
+LD = gcc $(CFLAGS) $(LDFLAGS)
RM = rm -f
INSTALL = install -c
--- a/unicon/ImmModules/cce/inputs/cin2dat.c
+++ b/unicon/ImmModules/cce/inputs/cin2dat.c
@@ -114,7 +114,7 @@
/* qcmp2 compare two ITEM2 structure, according to its key1/key2/ch */
int
-qcmp2 (ITEM2 * a, ITEM2 * b)
+qcmp2 (const ITEM2 * a, const ITEM2 * b)
{
if (a->key1 > b->key1)
return 1;
@@ -134,7 +134,7 @@
/* qcmp compare two ITEM2 structure, according to its key1/key2/occur_seq */
int
-qcmp (ITEM2 * a, ITEM2 * b)
+qcmp (const ITEM2 * a, const ITEM2 * b)
{
if (a->key1 > b->key1)
return 1;
@@ -148,7 +148,7 @@
}
int
-qcmp_ser (ITEM * a, ITEM * b)
+qcmp_ser (const ITEM * a, const ITEM * b)
{
if (a->ch > b->ch)
return 1;
--- a/unicon/ImmModules/cce/inputs/cin2tab.c
+++ b/unicon/ImmModules/cce/inputs/cin2tab.c
@@ -3,6 +3,7 @@
#include <stdarg.h>
#include <sys/types.h>
#include <string.h>
+#include <stdlib.h>
#include "xl_hzinput.h"
FILE *fr, *fw;
@@ -114,7 +115,7 @@
/* qcmp2 compare two ITEM2 structure, according to its key1/key2/ch */
int
-qcmp2 (ITEM2 * a, ITEM2 * b)
+qcmp2 (const ITEM2 * a, const ITEM2 * b)
{
if (a->key1 > b->key1)
return 1;
@@ -152,7 +153,7 @@
}
int
-qcmp_ser (ITEM * a, ITEM * b)
+qcmp_ser (const ITEM * a, const ITEM * b)
{
if (a->ch > b->ch)
return 1;
--- a/unicon/ImmModules/cce/inputs/tab2txt.c
+++ b/unicon/ImmModules/cce/inputs/tab2txt.c
@@ -71,7 +71,7 @@
exit (1);
}
- if (fseek (in, -4, SEEK_END) == -1 ||
+ if (fseek (in, -sizeof(int), SEEK_END) == -1 ||
fread (&fsize, sizeof (int), 1, in) != 1 || fsize != ftell (in) - sizeof (int)) // error!!
{
fprintf (stderr, "%s is not a valid pinyin phrase file.\n", infile);
--- a/unicon/ImmModules/cce/xl_pinyin.c
+++ b/unicon/ImmModules/cce/xl_pinyin.c
@@ -43,7 +43,8 @@
static int LoadPinyinTable (char *pathname);
static int SaveSysPhrase (char *pathname, int remove);
-static int SaveUsrPhrase (char *pathname);
+//static int SaveUsrPhrase (char *pathname);
+int SaveUsrPhrase (char *pathname);
static int LoadUsrPhrase (char *pathname);
static int LoadSysPhrase (char *pathname);
static void FindMatchPhrase (InputModule * inmd, PYString pinyin[],
@@ -59,11 +60,13 @@
// MAX_EACH_PY = 38 a[], b[], c[] ....
// map the pinyin to keys
static SysPhrase *sysph[MAX_PY_NUM]; // system phrases
-static int sys_size;
+static int sys_size,sys_num;
-static int FuzzyPinyin; // zh-ch-sh z-c-s
+static int FuzzyPinyin =0 ; // zh-ch-sh z-c-s
static UsrPhrase *usrph[MAX_PY_NUM]; //user defined phrase
+static int LoadPhraseFrequency(char *pathname);
+
/**************************************************************************
* Structure of the Char/Phrases *
* u_char len; // char/phrase len *
@@ -134,38 +137,38 @@
//Rat: modified for processing user-defined dictionaries
if ((usrhome = getenv ("HOME")) != NULL)
- {
- sprintf (buf, "%s/%s", usrhome, ".pyinput");
+ {
+ snprintf (buf,sizeof(buf)-1, "%s/%s", usrhome, ".pyinput");
retval = stat (buf, &statbuf);
if ((retval == 0))
{
if ((statbuf.st_mode & S_IFMT) == S_IFDIR)
{
- sprintf (buf, "%s/%s/%s", usrhome, ".pyinput", "usrphrase.tab");
+ snprintf (buf, sizeof(buf)-1, "%s/%s/%s", usrhome, ".pyinput", "usrphrase.tab");
if ( (retval = stat(buf, &statbuf)) == 0)
{
if ( statbuf.st_size < MIN_USRPHR_SIZE || LoadUsrPhrase (buf) == -1)
{
- printf ("Couldn't load %s. Please fix it.\n", buf);
- sprintf (buf, "%s/%s", szPath, "usrphrase.tab");
- if ((retval = access (buf, R_OK)) == 0)
- {
- if (LoadUsrPhrase (buf) == -1)
- printf ("Couldn't load %s. Please fix it.\n",
- buf);
+ printf ("Couldn't load %s. Please fix it. size or load error\n", buf);
+ snprintf (buf, sizeof(buf)-1, "%s/%s", szPath, "usrphrase.tab");
+ if ((retval = access (buf, R_OK)) == 0)
+ {
+ if (LoadUsrPhrase (buf) == -1)
+ printf ("Couldn't load %s. Please fix it. sysfile\n",
+ buf);
+ }
+ }
}
- }
- }
- else
- {
- creat (buf, 0600);
- sprintf (buf, "%s/%s", szPath, "usrphrase.tab");
+ else
+ {
+ creat (buf, 0600);
+ snprintf (buf, sizeof(buf)-1, "%s/%s", szPath, "usrphrase.tab");
if ((retval = access (buf, R_OK)) == 0)
{
if (LoadUsrPhrase (buf) == -1)
- printf ("Couldn't load %s. Please fix it.\n", buf);
+ printf ("Couldn't load %s. Please fix it. couldn't access\n", buf);
}
}
}
@@ -178,15 +181,15 @@
else
{
mkdir (buf, 0700); //Rat: making $HOME/.pyinput
- sprintf (buf, "%s/%s/%s", usrhome, ".pyinput", "usrphrase.tab");
+ snprintf (buf, sizeof(buf)-1, "%s/%s/%s", usrhome, ".pyinput", "usrphrase.tab");
creat (buf, 0600); //Rat: making $HOME/.pyinput/usrphrase.tab
- sprintf (buf, "%s/%s", szPath, "usrphrase.tab");
+ snprintf (buf, sizeof(buf)-1, "%s/%s", szPath, "usrphrase.tab");
if ((retval = access (buf, R_OK)) == 0)
{
if (LoadUsrPhrase (buf) == -1)
{
- printf ("Couldn't load %s. Please fix it.\n", buf);
+ printf ("Couldn't load %s. Please fix it. create\n", buf);
}
}
}
@@ -194,7 +197,7 @@
else
{
printf ("Sorry, I couldn't find your $HOME.\n");
- sprintf (buf, "%s/%s", szPath, "usrphrase.tab");
+ snprintf (buf, sizeof(buf)-1, "%s/%s", szPath, "usrphrase.tab");
printf ("Turn to access %s", buf);
if ((retval = access (buf, R_OK)) != 0)
@@ -207,6 +210,13 @@
}
+ snprintf(buf,sizeof(buf)-1,"%s/%s/%s",usrhome,".pyinput","sysfrequency.tab");
+ if(LoadPhraseFrequency(buf) == -1)
+ {
+ creat(buf,0700);
+ SavePhraseFrequency(buf);
+ }
+
return 1;
}
@@ -219,7 +229,7 @@
AdjustPhraseFreq (); // lower the freq to [0,50)
if (usrhome != NULL)
{
- sprintf (szFileName, "%s/%s/%s", usrhome, ".pyinput", "usrphrase.tab");
+ snprintf (szFileName, sizeof(szFileName)-1, "%s/%s/%s", usrhome, ".pyinput", "usrphrase.tab");
SaveUsrPhrase (szFileName);
}
else
@@ -265,7 +275,8 @@
}
/* need to combine the same pinyin/phrases */
-static int
+//static int
+int
SaveUsrPhrase (char *pathname)
{
int i, tmpcount;
@@ -340,6 +351,53 @@
return 0;
}
+int SavePhraseFrequency(char *pathname)
+{
+ FILE *stream;
+ Phrase *sph;
+ SysPhrase *sysph_tmp;
+ char *f;
+ char *p;
+ int i,j,k,index,pcount;
+
+ if ( (stream = fopen(pathname , "wb" )) == NULL )
+ {
+ fatal("%s file can't open\n",pathname);
+ return -1;
+ }
+
+ f = (char *) malloc (sys_num);
+ memset (f, 0, sys_num);
+ pcount=0;
+
+ for(i = 1; i < MAX_PY_NUM; i++)
+ {
+ sysph_tmp = sysph[i];
+ assert (sysph_tmp != NULL);
+ p = (char*)sysph_tmp->phrase; // count = total pinyin number
+ for(j = 0; j < sysph_tmp->count; j++)
+ {
+ sph = (Phrase *)p;
+ assert (sph != NULL);
+ for(k = 0; k < sph->count; k++)
+ {
+ index = sph->len+1 + (2*sph->len+1)*k + 2*sph->len;
+ f[pcount]=sph->key[index];
+ pcount++;
+ }
+ p += SizeOfPhrase(sph->len,sph->count);
+ }
+ }
+ assert (pcount==sys_num);
+ fseek(stream,0,SEEK_SET);
+ fwrite(f, sys_num, 1, stream);
+ fwrite(&(sys_size),sizeof(int),1,stream);
+ fwrite(&(sys_num),sizeof(int),1,stream);
+ free(f);
+ fclose(stream);
+ return 0;
+}
+
// don't save the frequency information, all lost?
static int
SaveSysPhrase (char *pathname, int remove)
@@ -483,6 +541,7 @@
fseek (stream, 0, SEEK_SET);
p = (char *) malloc (sys_size);
memset (p, 0, sys_size);
+ sys_num = 0;
/* Attach the shared segment to local address space */
if (fread (p, sys_size, 1, stream) != 1)
{
@@ -494,15 +553,74 @@
sysph[i] = sysph_tmp = (SysPhrase *) p;
p = (char *) sysph_tmp->phrase;
for (j = 0; j < sysph_tmp->count; j++)
- {
+ {
kph = (Phrase *) p;
p += SizeOfPhrase (kph->len, kph->count); // skip the string
- }
+ sys_num += kph->count;
+ }
}
fclose (stream);
return 0;
}
+static int LoadPhraseFrequency(char *pathname)
+{
+ FILE *stream;
+ Phrase *sph;
+ SysPhrase *sysph_tmp;
+ char *f;
+ char *p;
+ int i,j,k,index,sys_size_tmp,sys_num_tmp,pcount;
+
+ if ( (stream = fopen(pathname , "rb" )) == NULL )
+ {
+ fatal("%s file can't open\n",pathname);
+ return -1;
+ }
+
+ if (fseek(stream,-sizeof(int)*2,SEEK_END) == -1 ||
+ fread(&(sys_size_tmp),sizeof(int),1,stream) != 1 ||
+ fread(&(sys_num_tmp),sizeof(int),1,stream) != 1 ||
+ sys_size != sys_size_tmp||
+ sys_num_tmp != ftell(stream)-sizeof(int)*2 ||
+ sys_num != sys_num_tmp) // error!!
+ {
+ fatal("%s is not a valid pinyin phrase frequency file.\n",pathname);
+ return -1;
+ }
+ fseek(stream,0,SEEK_SET);
+ f = (char *) malloc (sys_num);
+ memset (f, 0, sys_num);
+ if (fread(f, sys_num, 1, stream) != 1)
+ {
+ fatal("Load File %s Error.\n", pathname);
+ return -1;
+ }
+ //
+ pcount=0;
+ for(i = 1; i < MAX_PY_NUM; i++)
+ {
+ sysph_tmp = sysph[i];
+ assert (sysph_tmp != NULL);
+ p = (char*)sysph_tmp->phrase; // count = total pinyin number
+ for(j = 0; j < sysph_tmp->count; j++)
+ {
+ sph = (Phrase *)p;
+ assert (sph != NULL);
+ for(k = 0; k < sph->count; k++)
+ {
+ index = sph->len+1 + (2*sph->len+1)*k + 2*sph->len;
+ sph->key[index] = f[pcount];
+ pcount++;
+ }
+ p += SizeOfPhrase(sph->len,sph->count);
+ }
+ }
+ free(f);
+ fclose(stream);
+ return 0;
+}
+
// When loading the phrase library, save it in memory
// structure, dynamic linklist
/* str, hanzi codes, key: pinyin codes, len: length, pass: system/user */
@@ -676,6 +794,7 @@
inmd->lenkey = 0;
inmd->key[0] = '\0';
inmd->nTotalCurSel = 0;
+ inmd->flg_english = 0;
}
// pinyin[0]-pinyin[len-1], parsed pinyin chars
@@ -710,6 +829,7 @@
if (!inmd->len)
return NULL;
+ printf("szGetSelectPhrase called\n");
idx = inmd->startpos + n;
@@ -735,6 +855,15 @@
char strhz[MAX_PHRASE_LEN * 2 + 1];
int pos, idx;
+
+ if (ch == '\n')
+ {
+ strcpy(strbuf,inmd->inbuf);
+ ResetPinyinInput(inmd);
+ return 2;
+ }
+
+
if (!inmd->len)
return 1;
@@ -782,12 +911,16 @@
}
else // not yet, some unselected pinyin exist
{
+ inmd->flg_english = 0;
// forward the pinyinpos pointer
for (pos = strlen (strhz) / 2; pos > 0; inmd->pinyinpos++)
{
ch = inmd->pinyin[inmd->pinyinpos][0];
if (ch == 'i' || ch == 'u' || ch == 'v' || ch < 'a' || ch > 'z')
+ {
+ inmd->flg_english = 1;
continue;
+ }
pos--;
}
@@ -820,21 +953,26 @@
char chtmp;
int count;
+ int i;
+ char tmpbuf[128];
/* \010 = Ctrl+H, \177 = BackSpace */
if (ch == '\010' || ch == '\177') // BackSpace
{
if (!strlen (inbuf))
- return 0;
+ return 0;
else if (!strlen (inbuftmp))
{
strcpy (inbuftmp, inbuf);
+ inbuf[strlen(inbuf)-1] = '\0';
*pybuftmp = '\0'; // clear all the selected chars, reparse
}
else
{
inbuf[strlen (inbuf) - 1] = '\0';
- inbuftmp[strlen (inbuftmp) - 1] = '\0'; // cut one pinyin-char off
+ if(inmd->flg_english) strcpy(inbuftmp,inbuf);
+ else inbuftmp[strlen (inbuftmp) - 1] = '\0'; // cut one pinyin-char off
+
if (!strlen (inbuf))
{
ResetPinyinInput (inmd);
@@ -862,7 +1000,8 @@
chtmp = inmd->pinyin[inmd->lenpy - 1][0];
if (chtmp == 'i' || chtmp == 'u' || chtmp == 'v')
{
- inbuf[strlen (inbuf) - 1] = '\0';
+// inbuf[strlen (inbuf) - 1] = '\0';
+ inmd->flg_english = 1;
inbuftmp[strlen (inbuftmp) - 1] = '\0';
inmd->lenpy--;
return 1;
@@ -871,7 +1010,7 @@
/* Too many chars now */
if (EffectPyNum (inmd->pinyin, inmd->lenpy) > MAX_PHRASE_LEN)
{
- inbuf[strlen (inbuf) - 1] = '\0';
+// inbuf[strlen (inbuf) - 1] = '\0';
inbuftmp[strlen (inbuftmp) - 1] = '\0';
inmd->lenpy--;
return 1;
@@ -881,6 +1020,14 @@
FillForwardSelection (inmd, 0);
CreatePyMsg (inmd);
+ tmpbuf[0] = '\0';
+ for(i = 0;i < inmd->lenpy; i++)
+ {
+ strcat(tmpbuf,inmd->pinyin[i]);
+ }
+ if(strcmp(inmd->inbuf,tmpbuf)) inmd->flg_english = 1;
+ else inmd->flg_english = 0;
+
return 1;
}
@@ -921,8 +1068,8 @@
break;
default: // select some keys
- if ((ch >= '1' && ch <= '9') || ch == '0' || ch == ' ')
- return SelectKeyPressed (inmd, ch, strbuf);
+ if ((ch >= '1' && ch <= '9') || ch == '0' || ch == ' ' || ch == '\n')
+ return SelectKeyPressed (inmd, ch, strbuf);
break;
}
return 0;
@@ -952,6 +1099,12 @@
continue;
}
+ if (pybuf[offset] == 'v' || pybuf[offset] == 'i' || pybuf[offset] == 'u')
+ {
+ offset++; count = 2;
+ continue;
+ }
+
ahead = pybuf[offset] - 'a';
if (ahead < 0 || ahead > 25)
return 0;
@@ -1004,13 +1157,13 @@
// temporary array, 500 items
int lenarr[MAX_PHRASE_LEN], result;
- char ch;
+ char ch, ch2='\0';
if (!lenpy)
- {
+ {
inmd->len = 0;
return;
- }
+ }
/* first of all, fill the pykey array */
for (i = 0; i < lenpy; i++)
@@ -1022,9 +1175,14 @@
ahead = pinyin[i][0] - 'a';
lenkey = 0;
tmplen = strlen (pinyin[i]);
+ if(tmplen > 1)
+ ch2 = pinyin[i][1];
for (j = 0; (keytmp = pytab[ahead][j].key); j++)
{
- if (tmplen == 1 || !strncmp (pinyin[i], pytab[ahead][j].py, tmplen))
+// if (tmplen == 1 || !strncmp (pinyin[i], pytab[ahead][j].py, tmplen))
+ if (tmplen == 1 || !strcmp (pinyin[i], pytab[ahead][j].py)
+ || ((tmplen == 2) && (!FuzzyPinyin)&&(ch=='z'||ch=='c'||ch=='s')
+ &&(ch2=='h')))
// prefix match
{
pykey[count][lenkey++] = keytmp;
@@ -1048,7 +1206,7 @@
}
}
pykey[count++][lenkey] = 0;
- } // for i = 1 to lenpy, pykey array filled
+ } // for i = 1 to lenpy, pykey array filled
for (i = 0; i < MAX_PHRASE_LEN; i++)
lenarr[i] = 0;
@@ -1334,13 +1492,17 @@
int
CCE_GetInputDisplay (InputModule * p, char *buf)
{
- strcpy (buf, p->iapybuf);
+// strcpy (buf, p->iapybuf);
+ if(p->flg_english) strcpy(buf, p->inbuf);
+ else strcpy(buf, p->iapybuf);
return 1;
}
int
CCE_GetSelectDisplay (InputModule * p, char *buf)
{
- strcpy (buf, p->iahzbuf);
+// strcpy (buf, p->iahzbuf);
+ if(p->flg_english) strcpy(buf, p->inbuf);
+ else strcpy(buf, p->iahzbuf);
return p->nTotalCurSel;
}
--- a/unicon/ImmModules/cce/xl_pinyin.h
+++ b/unicon/ImmModules/cce/xl_pinyin.h
@@ -137,6 +137,7 @@
// MAX_HZ_BUF = 250
int nTotalCurSel; /* Total Selection */
int SelectionLen;
+ int flg_english;
}
InputModule; // about 30KB
@@ -149,6 +150,8 @@
int Pinyin_KeyFilter (InputModule * inmd, u_char key, char *buf, int *len);
int Pinyin_KeyPressed (InputModule * inmd, u_char key);
void RefreshPYInputArea (InputModule * inmd);
+int SaveUsrPhrase(char *pathname);
+int SavePhraseFrequency(char *pathname);
int UnloadSysPhrase ();
int UnloadUserPhrase ();
--- a/unicon/ImmModules/cxterm/Makefile.in
+++ b/unicon/ImmModules/cxterm/Makefile.in
@@ -5,13 +5,13 @@
PROG = cxterm_hzinput.so
OBJS = hzinput.o Cxterm_hzinput.o
-CFLAGS = -g -Wall -I../../include -I.
+CFLAGS = -fPIC -g -Wall -I../../include -I.
all: $(PROG)
cd utils && make
cd dict && make
$(PROG) : $(OBJS)
- gcc $(OBJS) -shared -o $(PROG)
+ gcc $(OBJS) -fPIC -shared -o $(PROG)
Cxterm_hzinput.o : Cxterm_hzinput.c
gcc $(CFLAGS) -c Cxterm_hzinput.c -o Cxterm_hzinput.o
hzinput.o : hzinput.c
--- a/unicon/ImmModules/turbo/Makefile.in
+++ b/unicon/ImmModules/turbo/Makefile.in
@@ -1,11 +1,11 @@
prefix=@prefix@
CFLAGS=@CFLAGS@
# CFLAGS += -V2.7.2.3 -I.
-CFLAGS += -I.
+CFLAGS += -I. -O2
PROG = TL_hzinput.so
TL_OBJS = xl_hzinput.o TL_hzinput.o xl_phrase.o xl_sysphrase.o xl_mfile.o
-CFLAGS = -g -Wall -I../../include -I.
+CFLAGS = -fPIC -g -Wall -I../../include -I.
all:dlib
dlib: $(PROG)
@@ -21,7 +21,7 @@
xl_sysphrase.o : xl_sysphrase.c
gcc $(CFLAGS) -c xl_sysphrase.c -o xl_sysphrase.o
$(PROG): $(TL_OBJS)
- gcc $(TL_OBJS) -shared -o $(PROG)
+ gcc $(TL_OBJS) -fPIC -shared -o $(PROG) $(LDFLAGS)
# GB Support
gbdata: cin2tab addphrase levelphrase
@@ -62,8 +62,11 @@
install: all
mkdir -p $(prefix)/lib/unicon/modules/turbo
cp -f *.so $(prefix)/lib/unicon/modules/turbo
-data-install: big5data gbdata
- mkdir -p $(prefix)/lib/unicon/modules/turbo/dict/{gb,gbk,big5}
+#data-install: big5data gbdata
+data-install:
+ mkdir -p $(prefix)/lib/unicon/modules/turbo/dict/gb
+ mkdir -p $(prefix)/lib/unicon/modules/turbo/dict/gbk
+ mkdir -p $(prefix)/lib/unicon/modules/turbo/dict/big5
cp -f tl_sysphrase.*.bin $(prefix)/lib/unicon/modules/turbo
cp -f gb/*.tab $(prefix)/lib/unicon/modules/turbo/dict/gb
cp -f gbk/*.tab $(prefix)/lib/unicon/modules/turbo/dict/gbk
--- a/unicon/ImmModules/turbo/xl_hzinput.c
+++ b/unicon/ImmModules/turbo/xl_hzinput.c
@@ -239,11 +239,11 @@
}
static HzInputTable_T *pDefaultClient = NULL;
-static int qcmp (void *t1, void *t2)
+static int qcmp (const void *t1, const void *t2)
{
long c1, c2, k1, k2;
- long *a = (long *) t1,
- *b = (long *) t2;
+ const long *a = (long *) t1,
+ *b = (long *) t2;
int n1, n2, m1, m2;
static char p1[256], p2[256];
n1 = pDefaultClient->cur_table->item[*a].nPhrase;
--- a/unicon/ImmModules/turbo/xl_mfile.c
+++ b/unicon/ImmModules/turbo/xl_mfile.c
@@ -26,6 +26,7 @@
#include <stdlib.h>
#include <stdio.h>
+#include <string.h>
typedef struct MemFile_handle
{
--- a/unicon/ImmModules/turbo/xl_phrase.c
+++ b/unicon/ImmModules/turbo/xl_phrase.c
@@ -413,11 +413,11 @@
}
static TL_SysPhrase_T *pDefaultSysPhrase = NULL;
-static int qcmp (void *t1, void *t2)
+static int qcmp (const void *t1, const void *t2)
{
u_long c1, c2;
- ITEM *a = (ITEM *) t1,
- *b = (ITEM*) t2;
+ const ITEM *a = (ITEM *) t1,
+ *b = (ITEM*) t2;
if (a->key1 > b->key1)
return 1;
--- a/unicon/Makefile.in
+++ b/unicon/Makefile.in
@@ -2,9 +2,9 @@
all:
cd server; make
cd client; make
- cd unicon; make
+# cd unicon; make
cd ImmModules/cce && make
- cd ImmModules/cxterm && make
+# cd ImmModules/cxterm && make
cd ImmModules/turbo && make
ccedata:
cd ImmModules/cce/inputs && make
@@ -19,23 +19,25 @@
if [ ! -d $(prefix) ] ; then mkdir -p $(prefix); fi
if [ ! -d $(prefix)/lib/unicon ] ; then mkdir -p $(prefix)/lib/unicon; fi
if [ ! -d $(prefix)/bin ] ; then mkdir -p $(prefix)/bin; fi
- cd ImmModules/cce/inputs; make install
- cd ImmModules/turbo; make data-install
+ cd ImmModules/cce/inputs; make install prefix=$(prefix)
+ cd ImmModules/turbo; make data-install prefix=$(prefix)
install: all
if [ ! -d $(prefix) ] ; then mkdir -p $(prefix); fi
if [ ! -d $(prefix)/lib/unicon ] ; then mkdir -p $(prefix)/lib/unicon; fi
if [ ! -d $(prefix)/bin ] ; then mkdir -p $(prefix)/bin; fi
cd server; make install
cd client; make install
- cd unicon; make install
+# cd unicon; make install
cd ImmModules/cce; make install
- cd ImmModules/cxterm; make install
+# cd ImmModules/cxterm; make install
cd ImmModules/turbo; make install
+ cp -f unicon/sys-gb.tab $(prefix)/lib/unicon
+ cp -f unicon/sys-big5.tab $(prefix)/lib/unicon
clean:
cd server; make clean
cd client; make clean
- cd unicon; make clean
+# cd unicon; make clean
cd ImmModules/cce; make clean
cd ImmModules/cce/inputs; make clean
cd ImmModules/cxterm; make clean
@@ -47,10 +49,10 @@
distclean: clean
rm -f config.status config.log config.cache Makefile tags TAGS
cd server; make distclean
- cd unicon; make distclean
+# cd unicon; make distclean
cd client; make distclean
cd ImmModules/cce; make distclean
cd ImmModules/cce/inputs; make distclean
- cd ImmModules/cxterm; make distclean
+# cd ImmModules/cxterm; make distclean
cd ImmModules/turbo; make distclean
--- a/unicon/client/Makefile.in
+++ b/unicon/client/Makefile.in
@@ -7,7 +7,7 @@
DLIB_OBJS = TLC_LibImmClient.o TLC_Utils.o
SERVER_LIB=../server/libimm_server.so
-CFLAGS = -g -Wall -I. -I../include -I../server -I../client
+CFLAGS += -g -Wall -I. -I../include -I../server -I../client
# CFLAGS = -g -D__IMM_DEBUG__ -Wall -I. -I../include
all: $(PROG_LIB)
@@ -34,8 +34,8 @@
g++ $(CFLAGS) -D__DLL_SUPPORT__ -ldl -lpth test.cpp $(PROG_LIB) $(SERVER_LIB) -o test
install: all
- mkdir -p $(prefix)/lib/unicon
- cp -f $(PROG_LIB) $(prefix)/lib/unicon
+# mkdir -p $(prefix)/lib
+ cp -f $(PROG_LIB) $(prefix)/lib
clean:
rm -f *.o a.out core *~ *.bak $(PROG_LIB) $(PROG)
--- a/unicon/server/Makefile.in
+++ b/unicon/server/Makefile.in
@@ -1,7 +1,7 @@
prefix=@prefix@
CFLAGS = @CFLAGS@
APP_PROG = imm_server
-DLIB_PROG = libimm_server.so
+DLIB_PROG = libimm_server.so.0.0
APP_OBJS = TLS_HzInput.o TLS_ImmOp.o TLS_TcpipMain.o TLS_MemFile.o \
TLS_PthSocket.o TLS_Debug.o \
@@ -14,13 +14,13 @@
LIBS = /usr/lib/libpth.so -ldl
# CFLAGS = -g -D__IMM_DEBUG__ -Wall -I. -I/usr/include -I../include
-CFLAGS = -g -Wall -I. -I/usr/include -I../include
+CFLAGS = -fPIC -g -Wall -I. -I../include
CC=g++
all: $(DLIB_PROG)
-libimm_server.so: $(DLIB_OBJS)
- $(CC) $(DLIB_OBJS) -shared -o $(DLIB_PROG)
+libimm_server.so.0.0: $(DLIB_OBJS)
+ $(CC) $(DLIB_OBJS) -fPIC -Wl,-soname,libimm_server.so.0 -shared -o $(DLIB_PROG) -ldl $(LDFLAGS)
TLS_LibMain.o : TLS_LibMain.cpp
$(CC) $(CFLAGS) -DUNICON_LIB=\"$(prefix)/lib/unicon\" -c TLS_LibMain.cpp -o TLS_LibMain.o
@@ -46,9 +46,10 @@
install: all
mkdir -p $(prefix)/bin
- mkdir -p $(prefix)/lib/unicon
+ mkdir -p $(prefix)/lib
if [ -f $(APP_PROG) ]; then cp -f $(APP_PROG) $(prefix)/bin; fi
- if [ -f $(DLIB_PROG) ]; then cp -f $(DLIB_PROG) $(prefix)/lib/unicon; fi
+ if [ -f $(DLIB_PROG) ]; then cp -f $(DLIB_PROG) $(prefix)/lib; fi
+ cd $(prefix)/lib;ln -s libimm_server.so.0.0 libimm_server.so.0;ln -s libimm_server.so.0 libimm_server.so
clean:
if test -e $(PROG); then rm -f $(PROG); fi
--- a/unicon/server/TLS_Debug.cpp
+++ b/unicon/server/TLS_Debug.cpp
@@ -25,15 +25,17 @@
#include <stdio.h>
#include <stdlib.h>
-#include <iostream.h>
-#include <fstream.h>
+#include <iostream>
+#include <fstream>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
+#include <stdarg.h>
#include <TLS_Debug.hpp>
-TLS_CDebug::TLS_CDebug (char *szFileName, int mode = 0)
+
+TLS_CDebug::TLS_CDebug (char *szFileName, int mode)
{
if (szFileName == NULL)
{
--- a/unicon/server/TLS_ImmOp.cpp
+++ b/unicon/server/TLS_ImmOp.cpp
@@ -23,7 +23,7 @@
* Author: see CREDITS
*/
-#include <iostream.h>
+#include <iostream>
#include <stdio.h>
#include <string.h>
#include <dlfcn.h>
--- a/unicon/server/TLS_LibMain.cpp
+++ b/unicon/server/TLS_LibMain.cpp
@@ -35,7 +35,7 @@
#include <signal.h>
#include <netdb.h>
#include <unistd.h>
-#include <iostream.h>
+#include <iostream>
#include <pth.h>
#include <TLS_MemFile.hpp>
--- a/unicon/server/TLS_MemFile.cpp
+++ b/unicon/server/TLS_MemFile.cpp
@@ -23,7 +23,7 @@
* Author: see CREDITS
*/
-#include <iostream.h>
+#include <iostream>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
@@ -32,6 +32,8 @@
#include <TLS_MemFile.hpp>
+using namespace std;
+
TLS_CMemFile::TLS_CMemFile (u_long max0)
{
buf = (char *) malloc (max0);
--- a/unicon/server/TLS_PthSocket.cpp
+++ b/unicon/server/TLS_PthSocket.cpp
@@ -83,7 +83,7 @@
return b;
}
-int TLS_CPthSocket::read (void *buf, int buflen)
+int TLS_CPthSocket::Read (void *buf, int buflen)
{
short len;
#ifdef __IMM_DEBUG__
@@ -102,7 +102,7 @@
return len;
}
-int TLS_CPthSocket::write (void *buf, int len)
+int TLS_CPthSocket::Write (void *buf, int len)
{
short len0 = len;
#ifdef __IMM_DEBUG__
--- a/unicon/server/TLS_PthSocket.hpp
+++ b/unicon/server/TLS_PthSocket.hpp
@@ -36,8 +36,8 @@
public:
TLS_CPthSocket (int fd);
~TLS_CPthSocket ();
- int read (void *buf, int len);
- int write (void *buf, int len);
+ int Read (void *buf, int len);
+ int Write (void *buf, int len);
};
#endif
--- a/unicon/unicon/unicon.ini.in
+++ b/unicon/unicon/unicon.ini.in
@@ -49,8 +49,8 @@
MethodModule7=@PREFIX@/lib/unicon/modules/turbo/TL_hzinput.so
MethodTable7=@PREFIX@/lib/unicon/modules/turbo/dict/gb/CangJie.tab
MethodName7=
-MethodModule8=@PREFIX@/lib/unicon/modules/turbo/TL_hzinput.so
-MethodTable8=@PREFIX@/lib/unicon/modules/turbo/dict/gb/WuBi.tab
+MethodModule8=@PREFIX@/lib/unicon/modules/cce/cce_hzinput.so
+MethodTable8=@PREFIX@/lib/unicon/modules/cce/dict/wubi.tab
MethodName8=
MethodModule9=@PREFIX@/lib/unicon/modules/turbo/TL_hzinput.so
MethodTable9=@PREFIX@/lib/unicon/modules/turbo/dict/gb/QianMa.tab
@@ -110,8 +110,8 @@
MethodModule7=@PREFIX@/lib/unicon/modules/turbo/TL_hzinput.so
MethodTable7=@PREFIX@/lib/unicon/modules/turbo/dict/gb/CangJie.tab
MethodName7=
-MethodModule8=@PREFIX@/lib/unicon/modules/turbo/TL_hzinput.so
-MethodTable8=@PREFIX@/lib/unicon/modules/turbo/dict/gb/WuBi.tab
+MethodModule8=@PREFIX@/lib/unicon/modules/cce/cce_hzinput.so
+MethodTable8=@PREFIX@/lib/unicon/modules/cce/dict/wubi.tab
MethodName8=
MethodModule9=@PREFIX@/lib/unicon/modules/turbo/TL_hzinput.so
MethodTable9=@PREFIX@/lib/unicon/modules/turbo/dict/gb/QianMa.tab
--- a/unikey/Makefile.in
+++ b/unikey/Makefile.in
@@ -3,6 +3,7 @@
CFLAGS += -I. -I./include -I../include -I/usr/src/linux/include -include /usr/src/linux/include/linux/modversions.h
PROG = unikey.o
CC=gcc $(CFLAGS)
+DESTDIR =
MODCFLAGS = -Wall -O2 -DMODULE -D__KERNEL__ -DLINUX
|