From 36b51565fd334bf323bed0c6c4ec82f13cd695a7 Mon Sep 17 00:00:00 2001 From: "Vanilla I. Shu" Date: Tue, 13 May 2003 01:23:45 +0000 Subject: Add stardict2 2.0.0, english-Chinese dictionary. PR: 51185 Submitted by: Shen Chuan-Hsing --- textproc/stardict2/Makefile | 50 +++++++ textproc/stardict2/distinfo | 5 + .../files/patch-src::tools::olddic2newdic.c | 157 +++++++++++++++++++++ .../stardict2/files/patch-src::tools::oxford2dic.c | 64 +++++++++ .../stardict2/files/patch-src::tools::pydict2dic.c | 64 +++++++++ textproc/stardict2/pkg-descr | 5 + textproc/stardict2/pkg-plist | 49 +++++++ 7 files changed, 394 insertions(+) create mode 100644 textproc/stardict2/Makefile create mode 100644 textproc/stardict2/distinfo create mode 100644 textproc/stardict2/files/patch-src::tools::olddic2newdic.c create mode 100644 textproc/stardict2/files/patch-src::tools::oxford2dic.c create mode 100644 textproc/stardict2/files/patch-src::tools::pydict2dic.c create mode 100644 textproc/stardict2/pkg-descr create mode 100644 textproc/stardict2/pkg-plist (limited to 'textproc/stardict2') diff --git a/textproc/stardict2/Makefile b/textproc/stardict2/Makefile new file mode 100644 index 000000000000..efa9d32527b6 --- /dev/null +++ b/textproc/stardict2/Makefile @@ -0,0 +1,50 @@ +# Ports collection makefile for: stardict2 +# Date created: 13 April 2003 +# Whom: Shen Chuan-Hsing +# +# $FreeBSD$ +# + +PORTNAME= stardict2 +PORTVERSION= 2.0.0 +CATEGORIES= chinese +MASTER_SITES= http://reciteword.cosoft.org.cn/yaoguang/myapps/ \ + ftp://freebsd.sinica.edu.tw/pub/statue/stardict2/ +DISTFILES= stardict-${PORTVERSION}.tar.gz \ + stardict-cdict-big5-${PORTVERSION}.tar.bz2 \ + stardict-cedict-big5-${PORTVERSION}.tar.bz2 \ + stardict-xdict-big5-${PORTVERSION}.tar.bz2 \ + stardict-xdict-ce-big5-${PORTVERSION}.tar.bz2 + +MAINTAINER= statue@freebsd.sinica.edu.tw +COMMENT= English-Chinese dictionary + +LIB_DEPENDS= gnome-2.200:${PORTSDIR}/x11/libgnome \ + gnomeui-2.200:${PORTSDIR}/x11-toolkits/libgnomeui \ + bonobo-2.0:${PORTSDIR}/devel/libbonobo \ + bonobo-activation.4:${PORTSDIR}/devel/bonobo-activation + +GNU_CONFIGURE= yes +USE_GMAKE= yes +USE_X_PREFIX= yes +USE_BZIP2= yes +WRKSRC= ${WRKDIR}/stardict-${PORTVERSION} + +MAN1= stardict.1 + +do-extract: + ${MKDIR} ${WRKDIR} + cd ${WRKDIR} && tar zxf ${DISTDIR}/stardict-2.0.0.tar.gz && \ + tar jxf ${DISTDIR}/stardict-cdict-big5-2.0.0.tar.bz2 && \ + tar jxf ${DISTDIR}/stardict-cedict-big5-2.0.0.tar.bz2 && \ + tar jxf ${DISTDIR}/stardict-xdict-big5-2.0.0.tar.bz2 && \ + tar jxf ${DISTDIR}/stardict-xdict-ce-big5-2.0.0.tar.bz2 + +post-install: + ${MKDIR} ${PREFIX}/share/stardict/dic/ + ${INSTALL_DATA} ${WRKDIR}/stardict-cdict-big5-2.0.0/* ${PREFIX}/share/stardict/dic/ + ${INSTALL_DATA} ${WRKDIR}/stardict-cedict-big5-2.0.0/* ${PREFIX}/share/stardict/dic/ + ${INSTALL_DATA} ${WRKDIR}/stardict-xdict-big5-2.0.0/* ${PREFIX}/share/stardict/dic/ + ${INSTALL_DATA} ${WRKDIR}/stardict-xdict-ce-big5-2.0.0/* ${PREFIX}/share/stardict/dic/ + +.include diff --git a/textproc/stardict2/distinfo b/textproc/stardict2/distinfo new file mode 100644 index 000000000000..b6213f3e6220 --- /dev/null +++ b/textproc/stardict2/distinfo @@ -0,0 +1,5 @@ +MD5 (stardict-2.0.0.tar.gz) = 6ba52d96f1692a129f29601ac339ab49 +MD5 (stardict-cdict-big5-2.0.0.tar.bz2) = e66240efde994c0dc3bfd630cf9c53e5 +MD5 (stardict-cedict-big5-2.0.0.tar.bz2) = 372ae3391610634163443114382319b4 +MD5 (stardict-xdict-big5-2.0.0.tar.bz2) = 5bb8289d8381ea89d23eca60c7996519 +MD5 (stardict-xdict-ce-big5-2.0.0.tar.bz2) = 0d26411ac196cd240b266c95ede71bc2 diff --git a/textproc/stardict2/files/patch-src::tools::olddic2newdic.c b/textproc/stardict2/files/patch-src::tools::olddic2newdic.c new file mode 100644 index 000000000000..f888334a040f --- /dev/null +++ b/textproc/stardict2/files/patch-src::tools::olddic2newdic.c @@ -0,0 +1,157 @@ +--- src/tools/olddic2newdic.c.orig Sat May 3 18:48:30 2003 ++++ src/tools/olddic2newdic.c Mon May 5 04:05:05 2003 +@@ -52,28 +52,54 @@ + void convert(char *filename,char *idxheadfilename) + { + struct stat stats; ++ FILE *idxheadfile; ++ gchar *buffer; ++ FILE *idxfile,*dicfile; ++ gchar str[256],basename[256]; ++ long wordcount_offset; ++ glong tmpglong=0; ++ gboolean sametypesequence = FALSE; ++ int fd; ++ struct stat stStat; ++ int iFileSize; ++ unsigned int iCapacity,iStyle; ++ unsigned char cIndex, cWord, cMeaning, cMark; ++ caddr_t pFileMem; ++ caddr_t p=pFileMem; ++ caddr_t pMeaning, pMark; ++ gchar *utf8_str; ++ gsize write_size; ++ long tmp_long,wordcount=0; ++ int word_len, meaning_len,mark_len=0; ++ int iLength=0; ++ GArray *array; ++ struct _worditem worditem; ++ glong old_size; ++ long offset_old=0; ++ int i; ++ gchar *previous_word = g_strdup(""); //there should have no word equal this. ++ glong previous_datasize = 0; ++ gchar *previous_data = g_strdup(""); ++ struct _worditem *pworditem; ++ ++ + if (stat (idxheadfilename, &stats) == -1) + { + printf("idxhead file not exist!\n"); + return; + } + +- FILE *idxheadfile; + idxheadfile = fopen(idxheadfilename,"r"); +- gchar *buffer; + buffer = (gchar *)g_malloc (stats.st_size + 1); + fread (buffer, 1, stats.st_size, idxheadfile); + fclose (idxheadfile); + buffer[stats.st_size] = '\0'; +- gboolean sametypesequence = FALSE; + if (strstr(buffer,"sametypesequence=")) + sametypesequence = TRUE; + + //in the next code we will always treat sametypesequence to be TRUE. + //as now all old stardict dictionaries use these two feature. + +- FILE *idxfile,*dicfile; +- gchar str[256],basename[256]; + + strcpy(basename,idxheadfilename); + basename[strlen(idxheadfilename)-8]='\0'; +@@ -86,11 +112,10 @@ + fwrite(buffer, 1, stats.st_size, idxfile); + g_free(buffer); + +- long wordcount_offset = ftell(idxfile); +- glong tmpglong=0; ++ wordcount_offset = ftell(idxfile); + fwrite(&(tmpglong),sizeof(glong),1,idxfile); + +- int fd=open(filename,O_RDONLY); ++ fd=open(filename,O_RDONLY); + if(fd==-1) + { + g_print("open fail\n"); +@@ -98,17 +123,15 @@ + } + + // get length of dicfile. +- struct stat stStat; + if(fstat(fd,&stStat)!=0) + { + g_print("stat fail\n"); + return; + } +- int iFileSize=stStat.st_size; ++ iFileSize=stStat.st_size; + + // get item count + lseek(fd,0-sizeof(int)*2,SEEK_END); +- unsigned int iCapacity,iStyle; + read(fd,&iCapacity,sizeof(int)); + read(fd,&iStyle,sizeof(int)); + //disable the next two line when the convert file is from the same arch machine. +@@ -117,14 +140,14 @@ + vConvertEndian(&iStyle); + #endif + +- unsigned char cIndex=(unsigned char)(iStyle>>24); +- unsigned char cWord=(unsigned char)(iStyle>>16); +- unsigned char cMeaning=(unsigned char)(iStyle>>8); +- unsigned char cMark=(unsigned char)iStyle; ++ cIndex=(unsigned char)(iStyle>>24); ++ cWord=(unsigned char)(iStyle>>16); ++ cMeaning=(unsigned char)(iStyle>>8); ++ cMark=(unsigned char)iStyle; + g_print("flag: %c %c %c\n",cIndex,cWord,cMeaning); + + // mmap the file to memory +- caddr_t pFileMem=(caddr_t)mmap( (caddr_t)0,iFileSize-sizeof(int)*2, ++ pFileMem=(caddr_t)mmap( (caddr_t)0,iFileSize-sizeof(int)*2, + PROT_READ,MAP_SHARED|MAP_NORESERVE,fd,0 ); + if(pFileMem==MAP_FAILED) + { +@@ -133,9 +156,7 @@ + } + + // begin to read items. +- caddr_t p=pFileMem; +- caddr_t pMeaning, pMark; +- gchar *utf8_str; ++ p=pFileMem; + #ifndef DISABLE_CONVERT_LOCALE + gchar *locale_str; + gsize locale_write_size; +@@ -157,14 +178,7 @@ + return;*/ + + #endif +- gsize write_size; +- long tmp_long,wordcount=0; +- int word_len, meaning_len,mark_len=0; +- int iLength=0; +- +- GArray *array = g_array_sized_new(FALSE,FALSE, sizeof(struct _worditem),iCapacity); +- struct _worditem worditem; +- glong old_size; ++ array = g_array_sized_new(FALSE,FALSE, sizeof(struct _worditem),iCapacity); + + while(ppdata,parray->len,sizeof(gpointer),comparefunc,NULL); + g_array_sort(array,comparefunc); + +- long offset_old=0; +- +- int i; +- +- gchar *previous_word = g_strdup(""); //there should have no word equal this. +- glong previous_datasize = 0; +- gchar *previous_data = g_strdup(""); +- struct _worditem *pworditem; + for (i=0;ilen;i++) + { + pworditem = &g_array_index(array, struct _worditem, i); diff --git a/textproc/stardict2/files/patch-src::tools::oxford2dic.c b/textproc/stardict2/files/patch-src::tools::oxford2dic.c new file mode 100644 index 000000000000..8529786c8474 --- /dev/null +++ b/textproc/stardict2/files/patch-src::tools::oxford2dic.c @@ -0,0 +1,64 @@ +--- src/tools/oxford2dic.c.orig Mon May 5 04:05:50 2003 ++++ src/tools/oxford2dic.c Mon May 5 04:08:14 2003 +@@ -24,6 +24,19 @@ + { + struct stat stats; + FILE *oxfile,*idxfile,*dicfile; ++ gchar *buffer; ++ gchar *p1,*p2; ++ glong line_num = 0; ++ gchar *utf_str; ++ gsize write_size; ++ struct _worditem worditem; ++ GArray *array; ++ glong tmpglong=0; ++ long offset_old; ++ glong wordcount; ++ glong i; ++ gchar *previous_word = ""; ++ struct _worditem *pworditem; + + if (stat (filename, &stats) == -1) + { +@@ -32,21 +45,15 @@ + } + oxfile = fopen(filename,"r"); + +- gchar *buffer; + buffer = (gchar *)g_malloc (stats.st_size + 2); + fread (buffer, 1, stats.st_size, oxfile); + fclose (oxfile); + buffer[stats.st_size] = '\n'; + buffer[stats.st_size+1] = '\0'; + +- GArray *array = g_array_sized_new(FALSE,FALSE, sizeof(struct _worditem),39000); //oxford.txt have 77304 lines. +- struct _worditem worditem; ++ array = g_array_sized_new(FALSE,FALSE, sizeof(struct _worditem),39000); //oxford.txt have 77304 lines. + +- gchar *p1,*p2; +- glong line_num = 0; + p1 = buffer; +- gchar *utf_str; +- gsize write_size; + + while (1) { + if (*p1=='\0') { +@@ -91,17 +98,11 @@ + idxfile = fopen("oxford.idxdata","w"); + dicfile = fopen("oxford.dict","w"); + +- glong tmpglong=0; + fwrite(&(tmpglong),sizeof(glong),1,idxfile); + + + +- long offset_old; +- +- glong wordcount = array->len; +- glong i; +- gchar *previous_word = ""; +- struct _worditem *pworditem; ++ wordcount = array->len; + for (i=0;ilen;i++) + { + pworditem = &g_array_index(array, struct _worditem, i); diff --git a/textproc/stardict2/files/patch-src::tools::pydict2dic.c b/textproc/stardict2/files/patch-src::tools::pydict2dic.c new file mode 100644 index 000000000000..59016223c047 --- /dev/null +++ b/textproc/stardict2/files/patch-src::tools::pydict2dic.c @@ -0,0 +1,64 @@ +--- src/tools/pydict2dic.c.orig Fri Apr 25 18:55:55 2003 ++++ src/tools/pydict2dic.c Mon May 5 04:10:27 2003 +@@ -24,6 +24,20 @@ + { + struct stat stats; + FILE *pyfile,*ecidxfile,*ecdicfile,*ceidxfile,*cedicfile; ++ gchar *buffer; ++ GArray *ecarray; ++ struct _worditem ecworditem; ++ GArray *cearray; ++ struct _worditem ceworditem; ++ gchar *p1,*p2,*p3,*p4; ++ gchar *utf_str; ++ gsize write_size; ++ glong word_len; ++ long offset_old; ++ glong wordcount; ++ glong i; ++ gchar *previous_word = ""; ++ struct _worditem *pworditem; + + if (stat (filename, &stats) == -1) + { +@@ -32,24 +46,17 @@ + } + pyfile = fopen(filename,"r"); + +- gchar *buffer; + buffer = (gchar *)g_malloc (stats.st_size + 2); + fread (buffer, 1, stats.st_size, pyfile); + fclose (pyfile); + buffer[stats.st_size] = '\n'; + buffer[stats.st_size+1] = '\0'; + +- GArray *ecarray = g_array_sized_new(FALSE,FALSE, sizeof(struct _worditem),177785); //pydict.lib have 177785 lines. +- struct _worditem ecworditem; +- GArray *cearray = g_array_sized_new(FALSE,FALSE, sizeof(struct _worditem),177785); +- struct _worditem ceworditem; ++ ecarray = g_array_sized_new(FALSE,FALSE, sizeof(struct _worditem),177785); //pydict.lib have 177785 lines. ++ cearray = g_array_sized_new(FALSE,FALSE, sizeof(struct _worditem),177785); + +- gchar *p1,*p2,*p3,*p4; + p1 = buffer; +- gchar *utf_str; +- gsize write_size; +- glong word_len; +- ++ + while (1) { + if (*p1=='\0') { + g_print("over\n"); +@@ -142,12 +149,6 @@ + fprintf(ceidxfile,"stardict's idx file\ndictfile=pydict-big5-ce.dict\nbookname=pydict-big5-ce\nbeigin:\n"); + */ + +- long offset_old; +- +- glong wordcount; +- glong i; +- gchar *previous_word = ""; +- struct _worditem *pworditem; + + wordcount = ecarray->len; + for (i=0;ilen;i++) diff --git a/textproc/stardict2/pkg-descr b/textproc/stardict2/pkg-descr new file mode 100644 index 000000000000..553ba71b5418 --- /dev/null +++ b/textproc/stardict2/pkg-descr @@ -0,0 +1,5 @@ +StarDict is a international dictionary that run in Gnome envornment. +It have powerful features such as "Glob-style pattern matching", +"Scan seletion word","Fuzzy search" and etc. + +WWW: http://stardict.cosoft.org.cn/ diff --git a/textproc/stardict2/pkg-plist b/textproc/stardict2/pkg-plist new file mode 100644 index 000000000000..cc8d0f6bff43 --- /dev/null +++ b/textproc/stardict2/pkg-plist @@ -0,0 +1,49 @@ +bin/stardict +share/pixmaps/stardict.png +share/stardict/dic/cdict-big5.dict +share/stardict/dic/cdict-big5.idx.gz +share/stardict/dic/cedict-big5.dict +share/stardict/dic/cedict-big5.idx.gz +share/stardict/dic/xdict-big5.dict +share/stardict/dic/xdict-big5.idx.gz +share/stardict/dic/xdict-ce-big5.dict +share/stardict/dic/xdict-ce-big5.idx.gz +share/stardict/skins/default/about_menu.png +share/stardict/skins/default/docklet_normal.png +share/stardict/skins/default/docklet_scan.png +share/stardict/skins/default/docklet_stop.png +share/stardict/skins/default/phonetic.png +share/stardict/skins/default/skin.inf +share/gnome/help/stardict/C/legal.xml +share/gnome/help/stardict/C/stardict.xml +share/gnome/help/stardict/C/figures/stardict_float_window.png +share/gnome/help/stardict/C/figures/stardict_main_window.png +share/gnome/help/stardict/C/figures/stardict_notification_area.png +share/gnome/help/stardict/zh_CN/legal.xml +share/gnome/help/stardict/zh_CN/stardict.xml +share/gnome/help/stardict/zh_CN/figures/stardict_float_window.png +share/gnome/help/stardict/zh_CN/figures/stardict_main_window.png +share/gnome/help/stardict/zh_CN/figures/stardict_notification_area.png +share/omf/stardict/stardict-C.omf +share/omf/stardict/stardict-zh_CN.omf +share/applications/stardict.desktop +etc/gconf/schemas/stardict.schemas +lib/bonobo/servers/GNOME_Stardict.server +etc/gconf/gconf.xml.defaults/apps/stardict/%gconf.xml +etc/gconf/gconf.xml.defaults/apps/stardict/float_window/%gconf.xml +etc/gconf/gconf.xml.defaults/schemas/apps/stardict/%gconf.xml +etc/gconf/gconf.xml.defaults/schemas/apps/stardict/float_window/%gconf.xml +@dirrm share/gnome/help/stardict/zh_CN/figures +@dirrm share/gnome/help/stardict/zh_CN +@dirrm share/gnome/help/stardict/C/figures +@dirrm share/gnome/help/stardict/C +@dirrm share/gnome/help/stardict +@dirrm etc/gconf/gconf.xml.defaults/schemas/apps/stardict/float_window +@dirrm etc/gconf/gconf.xml.defaults/schemas/apps/stardict +@dirrm etc/gconf/gconf.xml.defaults/apps/stardict/float_window +@dirrm etc/gconf/gconf.xml.defaults/apps/stardict +@dirrm share/omf/stardict +@dirrm share/stardict/dic +@dirrm share/stardict/skins/default +@dirrm share/stardict/skins +@dirrm share/stardict -- cgit v1.2.3