1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-12 07:27:57 +00:00

add zh-tw-dictd

PR:		40741, 40743
Submitted by:	Kuang-che Wu <kcwu@kcwu.dyndns.org>
This commit is contained in:
Ying-Chieh Liao 2002-07-19 09:12:40 +00:00
parent 532324d2b5
commit 489dc39045
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=63226
4 changed files with 102 additions and 0 deletions

View File

@ -28,6 +28,7 @@
SUBDIR += cwtex
SUBDIR += cxterm
SUBDIR += dia
SUBDIR += dictd
SUBDIR += dictd-database
SUBDIR += emacs20
SUBDIR += enscript

18
chinese/dictd/Makefile Normal file
View File

@ -0,0 +1,18 @@
# New ports collection makefile for: dictd
# Date created: 19 July 2002
# Whom: Kuang-che Wu <kcwu@ck.tp.edu.tw>
#
# $FreeBSD$
#
CATEGORIES= chinese
MAINTAINER= kcwu@ck.tp.edu.tw
MASTERDIR= ${.CURDIR}/../../net/dictd
EXTRA_PATCHES= ${.CURDIR}/files/patch-index.c \
${.CURDIR}/files/patch-libmaa::arg.c
.include "${MASTERDIR}/Makefile"
PKGNAMEPREFIX:= ${PKGNAMEPREFIX}tw-

View File

@ -0,0 +1,71 @@
--- 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. */
while (*word && start < end && *start != '\t') {
+ if ((*start & 0x80) && start+1<end && start[1]!='\t') {
+ if(start[0]!=word[0])
+ return ((unsigned)word[0]<(unsigned)start[0])?-2:1;
+ if(start[1]!=word[1])
+ return ((unsigned)word[1]<(unsigned)start[1])?-2:1;
+ word+=2;
+ start+=2;
+ continue;
+ }
if (!isspacealnum(*start)) {
++start;
continue;
@@ -139,7 +148,11 @@
++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 );

View File

@ -0,0 +1,12 @@
--- libmaa/arg.c.orig Wed Jul 17 05:21:04 2002
+++ libmaa/arg.c Wed Jul 17 05:13:50 2002
@@ -216,6 +216,9 @@
++pt;
for (last = pt, len = 0; *pt; ++pt, ++len) {
+ if((*pt & 0x80) && pt[1]) {
+ ++pt, ++len;
+ } else
switch (*pt) {
case ' ':
case '\t':