diff options
-rw-r--r-- | chinese/dictd/Makefile | 11 | ||||
-rw-r--r-- | chinese/dictd/files/patch-Makefile.in | 10 | ||||
-rw-r--r-- | chinese/dictd/files/patch-dictfmt.c | 15 | ||||
-rw-r--r-- | chinese/dictd/files/patch-index.c | 90 |
4 files changed, 69 insertions, 57 deletions
diff --git a/chinese/dictd/Makefile b/chinese/dictd/Makefile index 4710032..6abec4a 100644 --- a/chinese/dictd/Makefile +++ b/chinese/dictd/Makefile @@ -11,8 +11,17 @@ MAINTAINER= kcwu@ck.tp.edu.tw MASTERDIR= ${.CURDIR}/../../net/dictd EXTRA_PATCHES= ${.CURDIR}/files/patch-index.c \ - ${.CURDIR}/files/patch-libmaa::arg.c + ${.CURDIR}/files/patch-libmaa::arg.c \ + ${.CURDIR}/files/patch-dictfmt.c \ + ${.CURDIR}/files/patch-Makefile.in + +pre-install: + ${ECHO} "bin/dictfmt" > ${PLIST} + ${CAT} ${MASTERDIR}/pkg-plist >> ${PLIST} .include "${MASTERDIR}/Makefile" PKGNAMEPREFIX:= ${PKGNAMEPREFIX}tw- +ALL_TARGET+= dictfmt +INSTALL_TARGET+=install.dictfmt +PLIST= ${WRKDIR}/PLIST diff --git a/chinese/dictd/files/patch-Makefile.in b/chinese/dictd/files/patch-Makefile.in new file mode 100644 index 0000000..4d48758 --- /dev/null +++ b/chinese/dictd/files/patch-Makefile.in @@ -0,0 +1,10 @@ +--- Makefile.in.orig Sun Nov 24 02:01:29 2002 ++++ Makefile.in Sun Nov 24 02:01:44 2002 +@@ -154,7 +154,6 @@ + if test ! -d $(bindir); then $(INSTALL) -d 755 $(bindir); fi + if test ! -d $(man1_prefix); then $(INSTALL) -d 755 $(man1_prefix); fi + $(INSTALL_PROGRAM) dictfmt $(bindir) +- $(INSTALL_PROGRAM) dictfmt_index2suffix $(bindir) + $(INSTALL_DATA) dictfmt.1 $(man1_prefix)/dictfmt.1 + + install.dictd: dictd diff --git a/chinese/dictd/files/patch-dictfmt.c b/chinese/dictd/files/patch-dictfmt.c new file mode 100644 index 0000000..6ed99b8 --- /dev/null +++ b/chinese/dictd/files/patch-dictfmt.c @@ -0,0 +1,15 @@ +--- dictfmt.c.orig Sun Nov 24 01:25:09 2002 ++++ dictfmt.c Sun Nov 24 01:25:23 2002 +@@ -208,6 +208,12 @@ + + while (src && src [0]){ + ch = *(const unsigned char *)src; ++ if((ch & 0x80) && *(src+1)) { ++ *dest++ = ch; ++ *dest++ = *(src+1); ++ src+=2; ++ continue; ++ } + + if (isspace (ch)){ + *dest++ = ' '; diff --git a/chinese/dictd/files/patch-index.c b/chinese/dictd/files/patch-index.c index a257941..23c0d93 100644 --- a/chinese/dictd/files/patch-index.c +++ b/chinese/dictd/files/patch-index.c @@ -1,8 +1,30 @@ ---- index.c.orig Mon Apr 29 22:43:42 2002 -+++ index.c Fri Jul 19 05:23:01 2002 -@@ -120,6 +120,15 @@ - - /* FIXME. Optimize this inner loop. */ +--- index.c.orig Sun Nov 24 01:24:10 2002 ++++ index.c Sun Nov 24 01:24:21 2002 +@@ -91,6 +91,12 @@ + + for (; *src; ++src) { + c = * (const unsigned char *) src; ++ if((c & 0x80) && *(src+1)) { ++ *dest++ = c; ++ *dest++ = *(src+1); ++ src++; ++ continue; ++ } + + if (isspace( c )) { + *dest++ = ' '; +@@ -150,7 +156,7 @@ + isspacealnumtab_allchars['\t'] = isspacealnumtab_allchars['\n'] = 0; /* special */ + + for (i = 0; i <= UCHAR_MAX; i++){ +- if (islower (i) || (utf8_mode && i >= 0xC0)) ++ if (islower (i) || (utf8_mode && i >= 0xC0) || (i>=0x80)) + chartab[charcount++] = i; + } + +@@ -317,6 +326,15 @@ + + /* FIXME. Optimize this inner loop. */ while (*word && start < end && *start != '\t') { + if ((*start & 0x80) && start+1<end && start[1]!='\t') { + if(start[0]!=word[0]) @@ -13,59 +35,15 @@ + start+=2; + continue; + } - if (!isspacealnum(*start)) { + if (!dbindex -> isspacealnum[* (const unsigned char *) start]) { ++start; continue; -@@ -139,7 +148,11 @@ +@@ -359,6 +377,8 @@ + *start != '\t' && + !dbindex -> isspacealnum[* (const unsigned char *) start]) + { ++ if((*start & 0x80) && start[1]!='\t') ++ break; ++start; } - -- while (*start != '\t' && !isspacealnum(*start)) ++start; -+ while (*start != '\t' && !isspacealnum(*start)) -+ if((*start & 0x80) && start[1]!='\t') -+ break; -+ else -+ ++start; - PRINTF(DBG_SEARCH,(" result = %d\n", - *word ? 1 : ((*start != '\t') ? -1 : 0))); -@@ -315,7 +328,6 @@ - int count = 0; - dictWord *datum; - const char *previous = NULL; -- - while (pt && pt < database->index->end) { - if (!compare( word, pt, database->index->end )) { - if (!previous || altcompare(previous, pt, database->index->end)) { -@@ -643,6 +655,7 @@ - char tmp; - dictWord *datum; - -+ if(*word & 0x80) return count; - #define CHECK \ - if ((pt = dict_index_search(buf, database->index)) \ - && !compare(buf, pt, database->index->end)) { \ -@@ -724,6 +737,11 @@ - if (isspace( *(const unsigned char *)w )) { - *pt++ = ' '; - } else { -+ if((*w & 0x80) && *(w+1)) { -+ *pt++=*w++; -+ *pt++=*w; -+ continue; -+ } - if (!isalnum( *(const unsigned char *)w )) continue; - *pt++ = tolower(*w); - } -@@ -790,6 +808,11 @@ - = binary_search( buf, i->start, i->end ); - } - for (j = '0'; j <= '9'; j++) { -+ buf[0] = j; -+ buf[1] = '\0'; -+ i->optStart[j] = binary_search( buf, i->start, i->end ); -+ } -+ for (j = 0x80; j <= 255; j++) { - buf[0] = j; - buf[1] = '\0'; - i->optStart[j] = binary_search( buf, i->start, i->end ); |