From statue@freebsd.sinica.edu.tw Sun Apr 20 07:14:54 2003 Return-Path: Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D720B37B404 for ; Sun, 20 Apr 2003 07:14:54 -0700 (PDT) Received: from freebsd.sinica.edu.tw (freebsd.sinica.edu.tw [140.109.13.51]) by mx1.FreeBSD.org (Postfix) with ESMTP id C010343FBF for ; Sun, 20 Apr 2003 07:14:51 -0700 (PDT) (envelope-from statue@freebsd.sinica.edu.tw) Received: by freebsd.sinica.edu.tw (Postfix, from userid 1014) id 0F604785; Sun, 20 Apr 2003 22:14:53 +0800 (CST) Message-Id: <20030420141453.0F604785@freebsd.sinica.edu.tw> Date: Sun, 20 Apr 2003 22:14:53 +0800 (CST) From: Statue Reply-To: Statue To: FreeBSD-gnats-submit@freebsd.org Cc: Subject: New port: chinese/stardict2 X-Send-Pr-Version: 3.113 X-GNATS-Notify: >Number: 51185 >Category: ports >Synopsis: New port: chinese/stardict2 >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: closed >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sun Apr 20 07:20:10 PDT 2003 >Closed-Date: Mon May 12 18:38:55 PDT 2003 >Last-Modified: Mon May 12 18:38:55 PDT 2003 >Originator: Statue >Release: FreeBSD 4.7-PRERELEASE i386 >Organization: >Environment: System: FreeBSD freebsd.sinica.edu.tw 4.7-PRERELEASE FreeBSD 4.7-PRERELEASE #2: Mon Sep 9 10:45:46 CST 2002 ycheng@freebsd.sinica.edu.tw:/usr/src/sys/compile/GENERIC i386 >Description: 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://reciteword.cosoft.org.cn/yaoguang/ >How-To-Repeat: >Fix: # This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # stardict2/ # stardict2/Makefile # stardict2/distinfo # stardict2/files # stardict2/pkg-descr # stardict2/pkg-plist # stardict2/files/patch-configure # stardict2/files/patch-src::tools::olddic2newdic.c # echo c - stardict2/ mkdir -p stardict2/ > /dev/null 2>&1 echo x - stardict2/Makefile sed 's/^X//' >stardict2/Makefile << 'END-of-stardict2/Makefile' X# Ports collection makefile for: stardict2 X# Date created: 13 April 2003 X# Whom: Shen Chuan-Hsing X# X# $FreeBSD$ X# X XPORTNAME= stardict2 XPORTVERSION= 2.0.0 XCATEGORIES= chinese XMASTER_SITES= http://reciteword.cosoft.org.cn/yaoguang/myapps/ \ X ftp://freebsd.sinica.edu.tw/pub/statue/stardict2/ XDISTNAME= stardict-${PORTVERSION}-pre2 X XMAINTAINER= statue@freebsd.sinica.edu.tw XCOMMENT= English-Chinese dictionary X XLIB_DEPENDS= gnome-2.200:${PORTSDIR}/x11/libgnome \ X gnomeui-2.200:${PORTSDIR}/x11-toolkits/libgnomeui \ X bonobo-2.0:${PORTSDIR}/devel/libbonobo \ X bonobo-activation.4:${PORTSDIR}/devel/bonobo-activation X XGNU_CONFIGURE= yes XUSE_GMAKE= yes XUSE_X_PREFIX= yes XWRKSRC= ${WRKDIR}/stardict-${PORTVERSION} X XMAN1= stardict.1 X X.include END-of-stardict2/Makefile echo x - stardict2/distinfo sed 's/^X//' >stardict2/distinfo << 'END-of-stardict2/distinfo' XMD5 (stardict-2.0.0-pre2.tar.gz) = d82c3cb859865db3c8135690aeed3759 END-of-stardict2/distinfo echo c - stardict2/files mkdir -p stardict2/files > /dev/null 2>&1 echo x - stardict2/pkg-descr sed 's/^X//' >stardict2/pkg-descr << 'END-of-stardict2/pkg-descr' XStarDict is a international dictionary that run in Gnome envornment. XIt have powerful features such as "Glob-style pattern matching", X"Scan seletion word","Fuzzy search" and etc. X XWWW: http://reciteword.cosoft.org.cn/yaoguang/ END-of-stardict2/pkg-descr echo x - stardict2/pkg-plist sed 's/^X//' >stardict2/pkg-plist << 'END-of-stardict2/pkg-plist' Xbin/stardict Xshare/pixmaps/stardict.png Xshare/stardict/dic/cdict.dict Xshare/stardict/dic/cdict.idx.gz Xshare/stardict/dic/cedictgb.dict Xshare/stardict/dic/cedictgb.idx.gz Xshare/stardict/dic/stardict.dict Xshare/stardict/dic/stardict.idx.gz Xshare/stardict/dic/xdict.dict Xshare/stardict/dic/xdict.idx.gz Xshare/stardict/dic/xdict_ce.dict Xshare/stardict/dic/xdict_ce.idx.gz Xshare/stardict/skins/default/phonetic.png Xshare/stardict/skins/default/skin.inf Xshare/gnome/help/stardict/C/legal.xml Xshare/gnome/help/stardict/C/stardict.xml Xshare/gnome/help/stardict/C/figures/stardict_applet.png Xshare/gnome/help/stardict/C/figures/stardict_window.png Xshare/gnome/help/stardict/zh_CN/legal.xml Xshare/gnome/help/stardict/zh_CN/stardict.xml Xshare/gnome/help/stardict/zh_CN/figures/stardict_applet.png Xshare/gnome/help/stardict/zh_CN/figures/stardict_window.png Xshare/omf/stardict/stardict-C.omf Xshare/omf/stardict/stardict-zh_CN.omf Xshare/applications/stardict.desktop Xetc/gconf/schemas/stardict.schemas Xlib/bonobo/servers/GNOME_Stardict.server Xetc/gconf/gconf.xml.defaults/apps/stardict/%gconf.xml Xetc/gconf/gconf.xml.defaults/apps/stardict/float_window/%gconf.xml Xetc/gconf/gconf.xml.defaults/schemas/apps/stardict/%gconf.xml Xetc/gconf/gconf.xml.defaults/schemas/apps/stardict/float_window/%gconf.xml X@dirrm share/gnome/help/stardict/zh_CN/figures X@dirrm share/gnome/help/stardict/zh_CN X@dirrm share/gnome/help/stardict/C/figures X@dirrm share/gnome/help/stardict/C X@dirrm share/gnome/help/stardict X@dirrm etc/gconf/gconf.xml.defaults/schemas/apps/stardict/float_window X@dirrm etc/gconf/gconf.xml.defaults/schemas/apps/stardict X@dirrm etc/gconf/gconf.xml.defaults/apps/stardict/float_window X@dirrm etc/gconf/gconf.xml.defaults/apps/stardict X@dirrm share/omf/stardict X@dirrm share/stardict/dic X@dirrm share/stardict/skins/default X@dirrm share/stardict/skins X@dirrm share/stardict END-of-stardict2/pkg-plist echo x - stardict2/files/patch-configure sed 's/^X//' >stardict2/files/patch-configure << 'END-of-stardict2/files/patch-configure' X--- configure.orig Wed Apr 9 09:30:40 2003 X+++ configure Sun Apr 13 10:34:49 2003 X@@ -10688,11 +10688,12 @@ X LIBS="-lpopt $LIBS" X X else X- { { echo "$as_me:$LINENO: error: popt 1.5 or newer is required to build X-stardict. You can download the latest version from ftp://people.redhat.com/sopwith/popt/" >&5 X-echo "$as_me: error: popt 1.5 or newer is required to build X-stardict. You can download the latest version from ftp://people.redhat.com/sopwith/popt/" >&2;} X- { (exit 1); exit 1; }; } X+ cat >>confdefs.h <<_ACEOF X+#define HAVE_LIBPOPT 1 X+_ACEOF X+ X+ LIBS="-lpopt $LIBS" X+ X fi X X END-of-stardict2/files/patch-configure echo x - stardict2/files/patch-src::tools::olddic2newdic.c sed 's/^X//' >stardict2/files/patch-src::tools::olddic2newdic.c << 'END-of-stardict2/files/patch-src::tools::olddic2newdic.c' X--- src/tools/olddic2newdic.c.orig Sun Apr 13 10:37:09 2003 X+++ src/tools/olddic2newdic.c Sun Apr 13 10:50:46 2003 X@@ -47,6 +47,30 @@ X { X FILE *idxfile,*dicfile; X gchar str[256]; X+ int fd; X+ struct stat stStat; X+ unsigned int iCapacity,iStyle; X+ unsigned char cIndex, cWord, cMeaning, cMark; X+ caddr_t pFileMem; X+ int iFileSize; X+ X+ caddr_t p; X+ caddr_t pMeaning, pMark; X+ gchar *utf8_str; X+ gsize write_size; X+ long tmp_long,wordcount=0; X+ int word_len, meaning_len,mark_len=0; X+ int iLength=0; X+ X+ GArray *array = g_array_sized_new(FALSE,FALSE, sizeof(struct _worditem),iCapacity); X+ struct _worditem worditem; X+ glong old_size; X+ X+ long offset_old; X+ X+ int i; X+ struct _worditem *pworditem; X+ X X sprintf(str,"%s.idx",newfilename); X idxfile = fopen(str,"w"); X@@ -55,7 +79,7 @@ X X fprintf(idxfile,"stardict's idx file\ndictfile=%s\nbookname=%s\nbeigin:\n", str, bookname); X X- int fd=open(filename,O_RDONLY); X+ fd=open(filename,O_RDONLY); X if(fd==-1) X { X g_print("open fail\n"); X@@ -63,30 +87,28 @@ X } X X // get length of dicfile. X- struct stat stStat; X if(fstat(fd,&stStat)!=0) X { X g_print("stat fail\n"); X return; X } X- int iFileSize=stStat.st_size; X+ iFileSize=stStat.st_size; X X // get item count X lseek(fd,0-sizeof(int)*2,SEEK_END); X- unsigned int iCapacity,iStyle; X read(fd,&iCapacity,sizeof(int)); X read(fd,&iStyle,sizeof(int)); X vConvertEndian(&iCapacity); X vConvertEndian(&iStyle); X X- unsigned char cIndex=(unsigned char)(iStyle>>24); X- unsigned char cWord=(unsigned char)(iStyle>>16); X- unsigned char cMeaning=(unsigned char)(iStyle>>8); X- unsigned char cMark=(unsigned char)iStyle; X+ cIndex=(unsigned char)(iStyle>>24); X+ cWord=(unsigned char)(iStyle>>16); X+ cMeaning=(unsigned char)(iStyle>>8); X+ cMark=(unsigned char)iStyle; X g_print("flag: %c %c %c\n",cIndex,cWord,cMeaning); X X // mmap the file to memory X- caddr_t pFileMem=(caddr_t)mmap( (caddr_t)0,iFileSize-sizeof(int)*2, X+ pFileMem=(caddr_t)mmap( (caddr_t)0,iFileSize-sizeof(int)*2, X PROT_READ,MAP_SHARED|MAP_NORESERVE,fd,0 ); X if(pFileMem==MAP_FAILED) X { X@@ -95,17 +117,7 @@ X } X X // begin to read items. X- caddr_t p=pFileMem; X- caddr_t pMeaning, pMark; X- gchar *utf8_str; X- gsize write_size; X- long tmp_long,wordcount=0; X- int word_len, meaning_len,mark_len=0; X- int iLength=0; X- X- GArray *array = g_array_sized_new(FALSE,FALSE, sizeof(struct _worditem),iCapacity); X- struct _worditem worditem; X- glong old_size; X+ p=pFileMem; X X while(ppdata,parray->len,sizeof(gpointer),comparefunc,NULL); X g_array_sort(array,comparefunc); X X- long offset_old; X- X- int i; X- X- struct _worditem *pworditem; X+ X for (i=0;ilen;i++) X { X pworditem = &g_array_index(array, struct _worditem, i); END-of-stardict2/files/patch-src::tools::olddic2newdic.c exit >Release-Note: >Audit-Trail: From: statue@freebsd.sinica.edu.tw (Statue) To: freebsd-gnats-submit@FreeBSD.org Cc: Subject: Re: ports/51185: New port: chinese/stardict2 Date: Fri, 9 May 2003 18:45:15 +0800 (CST) # This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # stardict2/ # stardict2/Makefile # stardict2/distinfo # stardict2/files # stardict2/pkg-descr # stardict2/pkg-plist # stardict2/files/patch-src::tools::olddic2newdic.c # stardict2/files/patch-src::tools::oxford2dic.c # stardict2/files/patch-src::tools::pydict2dic.c # echo c - stardict2/ mkdir -p stardict2/ > /dev/null 2>&1 echo x - stardict2/Makefile sed 's/^X//' >stardict2/Makefile << 'END-of-stardict2/Makefile' X# Ports collection makefile for: stardict2 X# Date created: 13 April 2003 X# Whom: Shen Chuan-Hsing X# X# $FreeBSD$ X# X XPORTNAME= stardict2 XPORTVERSION= 2.0.0 XCATEGORIES= chinese XMASTER_SITES= http://reciteword.cosoft.org.cn/yaoguang/myapps/ \ X ftp://freebsd.sinica.edu.tw/pub/statue/stardict2/ XDISTFILES= stardict-${PORTVERSION}.tar.gz \ X stardict-cdict-big5-${PORTVERSION}.tar.bz2 \ X stardict-cedict-big5-${PORTVERSION}.tar.bz2 \ X stardict-xdict-big5-${PORTVERSION}.tar.bz2 \ X stardict-xdict-ce-big5-${PORTVERSION}.tar.bz2 X XMAINTAINER= statue@freebsd.sinica.edu.tw XCOMMENT= English-Chinese dictionary X XLIB_DEPENDS= gnome-2.200:${PORTSDIR}/x11/libgnome \ X gnomeui-2.200:${PORTSDIR}/x11-toolkits/libgnomeui \ X bonobo-2.0:${PORTSDIR}/devel/libbonobo \ X bonobo-activation.4:${PORTSDIR}/devel/bonobo-activation X XGNU_CONFIGURE= yes XUSE_GMAKE= yes XUSE_X_PREFIX= yes XUSE_BZIP2= yes XWRKSRC= ${WRKDIR}/stardict-${PORTVERSION} X XMAN1= stardict.1 X Xdo-extract: X ${MKDIR} ${WRKDIR} X cd ${WRKDIR} && tar zxf ${DISTDIR}/stardict-2.0.0.tar.gz && \ X tar jxf ${DISTDIR}/stardict-cdict-big5-2.0.0.tar.bz2 && \ X tar jxf ${DISTDIR}/stardict-cedict-big5-2.0.0.tar.bz2 && \ X tar jxf ${DISTDIR}/stardict-xdict-big5-2.0.0.tar.bz2 && \ X tar jxf ${DISTDIR}/stardict-xdict-ce-big5-2.0.0.tar.bz2 X Xpost-install: X ${MKDIR} ${PREFIX}/share/stardict/dic/ X ${INSTALL_DATA} ${WRKDIR}/stardict-cdict-big5-2.0.0/* ${PREFIX}/share/stardict/dic/ X ${INSTALL_DATA} ${WRKDIR}/stardict-cedict-big5-2.0.0/* ${PREFIX}/share/stardict/dic/ X ${INSTALL_DATA} ${WRKDIR}/stardict-xdict-big5-2.0.0/* ${PREFIX}/share/stardict/dic/ X ${INSTALL_DATA} ${WRKDIR}/stardict-xdict-ce-big5-2.0.0/* ${PREFIX}/share/stardict/dic/ X X.include END-of-stardict2/Makefile echo x - stardict2/distinfo sed 's/^X//' >stardict2/distinfo << 'END-of-stardict2/distinfo' XMD5 (stardict-2.0.0.tar.gz) = 6ba52d96f1692a129f29601ac339ab49 XMD5 (stardict-cdict-big5-2.0.0.tar.bz2) = e66240efde994c0dc3bfd630cf9c53e5 XMD5 (stardict-cedict-big5-2.0.0.tar.bz2) = 372ae3391610634163443114382319b4 XMD5 (stardict-xdict-big5-2.0.0.tar.bz2) = 5bb8289d8381ea89d23eca60c7996519 XMD5 (stardict-xdict-ce-big5-2.0.0.tar.bz2) = 0d26411ac196cd240b266c95ede71bc2 END-of-stardict2/distinfo echo c - stardict2/files mkdir -p stardict2/files > /dev/null 2>&1 echo x - stardict2/pkg-descr sed 's/^X//' >stardict2/pkg-descr << 'END-of-stardict2/pkg-descr' XStarDict is a international dictionary that run in Gnome envornment. XIt have powerful features such as "Glob-style pattern matching", X"Scan seletion word","Fuzzy search" and etc. X XWWW: http://stardict.cosoft.org.cn/ END-of-stardict2/pkg-descr echo x - stardict2/pkg-plist sed 's/^X//' >stardict2/pkg-plist << 'END-of-stardict2/pkg-plist' Xbin/stardict Xshare/pixmaps/stardict.png Xshare/stardict/dic/cdict-big5.dict Xshare/stardict/dic/cdict-big5.idx.gz Xshare/stardict/dic/cedict-big5.dict Xshare/stardict/dic/cedict-big5.idx.gz Xshare/stardict/dic/xdict-big5.dict Xshare/stardict/dic/xdict-big5.idx.gz Xshare/stardict/dic/xdict-ce-big5.dict Xshare/stardict/dic/xdict-ce-big5.idx.gz Xshare/stardict/skins/default/about_menu.png Xshare/stardict/skins/default/docklet_normal.png Xshare/stardict/skins/default/docklet_scan.png Xshare/stardict/skins/default/docklet_stop.png Xshare/stardict/skins/default/phonetic.png Xshare/stardict/skins/default/skin.inf Xshare/gnome/help/stardict/C/legal.xml Xshare/gnome/help/stardict/C/stardict.xml Xshare/gnome/help/stardict/C/figures/stardict_float_window.png Xshare/gnome/help/stardict/C/figures/stardict_main_window.png Xshare/gnome/help/stardict/C/figures/stardict_notification_area.png Xshare/gnome/help/stardict/zh_CN/legal.xml Xshare/gnome/help/stardict/zh_CN/stardict.xml Xshare/gnome/help/stardict/zh_CN/figures/stardict_float_window.png Xshare/gnome/help/stardict/zh_CN/figures/stardict_main_window.png Xshare/gnome/help/stardict/zh_CN/figures/stardict_notification_area.png Xshare/omf/stardict/stardict-C.omf Xshare/omf/stardict/stardict-zh_CN.omf Xshare/applications/stardict.desktop Xetc/gconf/schemas/stardict.schemas Xlib/bonobo/servers/GNOME_Stardict.server Xetc/gconf/gconf.xml.defaults/apps/stardict/%gconf.xml Xetc/gconf/gconf.xml.defaults/apps/stardict/float_window/%gconf.xml Xetc/gconf/gconf.xml.defaults/schemas/apps/stardict/%gconf.xml Xetc/gconf/gconf.xml.defaults/schemas/apps/stardict/float_window/%gconf.xml X@dirrm share/gnome/help/stardict/zh_CN/figures X@dirrm share/gnome/help/stardict/zh_CN X@dirrm share/gnome/help/stardict/C/figures X@dirrm share/gnome/help/stardict/C X@dirrm share/gnome/help/stardict X@dirrm etc/gconf/gconf.xml.defaults/schemas/apps/stardict/float_window X@dirrm etc/gconf/gconf.xml.defaults/schemas/apps/stardict X@dirrm etc/gconf/gconf.xml.defaults/apps/stardict/float_window X@dirrm etc/gconf/gconf.xml.defaults/apps/stardict X@dirrm share/omf/stardict X@dirrm share/stardict/dic X@dirrm share/stardict/skins/default X@dirrm share/stardict/skins X@dirrm share/stardict END-of-stardict2/pkg-plist echo x - stardict2/files/patch-src::tools::olddic2newdic.c sed 's/^X//' >stardict2/files/patch-src::tools::olddic2newdic.c << 'END-of-stardict2/files/patch-src::tools::olddic2newdic.c' X--- src/tools/olddic2newdic.c.orig Sat May 3 18:48:30 2003 X+++ src/tools/olddic2newdic.c Mon May 5 04:05:05 2003 X@@ -52,28 +52,54 @@ X void convert(char *filename,char *idxheadfilename) X { X struct stat stats; X+ FILE *idxheadfile; X+ gchar *buffer; X+ FILE *idxfile,*dicfile; X+ gchar str[256],basename[256]; X+ long wordcount_offset; X+ glong tmpglong=0; X+ gboolean sametypesequence = FALSE; X+ int fd; X+ struct stat stStat; X+ int iFileSize; X+ unsigned int iCapacity,iStyle; X+ unsigned char cIndex, cWord, cMeaning, cMark; X+ caddr_t pFileMem; X+ caddr_t p=pFileMem; X+ caddr_t pMeaning, pMark; X+ gchar *utf8_str; X+ gsize write_size; X+ long tmp_long,wordcount=0; X+ int word_len, meaning_len,mark_len=0; X+ int iLength=0; X+ GArray *array; X+ struct _worditem worditem; X+ glong old_size; X+ long offset_old=0; X+ int i; X+ gchar *previous_word = g_strdup(""); //there should have no word equal this. X+ glong previous_datasize = 0; X+ gchar *previous_data = g_strdup(""); X+ struct _worditem *pworditem; X+ X+ X if (stat (idxheadfilename, &stats) == -1) X { X printf("idxhead file not exist!\n"); X return; X } X X- FILE *idxheadfile; X idxheadfile = fopen(idxheadfilename,"r"); X- gchar *buffer; X buffer = (gchar *)g_malloc (stats.st_size + 1); X fread (buffer, 1, stats.st_size, idxheadfile); X fclose (idxheadfile); X buffer[stats.st_size] = '\0'; X- gboolean sametypesequence = FALSE; X if (strstr(buffer,"sametypesequence=")) X sametypesequence = TRUE; X X //in the next code we will always treat sametypesequence to be TRUE. X //as now all old stardict dictionaries use these two feature. X X- FILE *idxfile,*dicfile; X- gchar str[256],basename[256]; X X strcpy(basename,idxheadfilename); X basename[strlen(idxheadfilename)-8]='\0'; X@@ -86,11 +112,10 @@ X fwrite(buffer, 1, stats.st_size, idxfile); X g_free(buffer); X X- long wordcount_offset = ftell(idxfile); X- glong tmpglong=0; X+ wordcount_offset = ftell(idxfile); X fwrite(&(tmpglong),sizeof(glong),1,idxfile); X X- int fd=open(filename,O_RDONLY); X+ fd=open(filename,O_RDONLY); X if(fd==-1) X { X g_print("open fail\n"); X@@ -98,17 +123,15 @@ X } X X // get length of dicfile. X- struct stat stStat; X if(fstat(fd,&stStat)!=0) X { X g_print("stat fail\n"); X return; X } X- int iFileSize=stStat.st_size; X+ iFileSize=stStat.st_size; X X // get item count X lseek(fd,0-sizeof(int)*2,SEEK_END); X- unsigned int iCapacity,iStyle; X read(fd,&iCapacity,sizeof(int)); X read(fd,&iStyle,sizeof(int)); X //disable the next two line when the convert file is from the same arch machine. X@@ -117,14 +140,14 @@ X vConvertEndian(&iStyle); X #endif X X- unsigned char cIndex=(unsigned char)(iStyle>>24); X- unsigned char cWord=(unsigned char)(iStyle>>16); X- unsigned char cMeaning=(unsigned char)(iStyle>>8); X- unsigned char cMark=(unsigned char)iStyle; X+ cIndex=(unsigned char)(iStyle>>24); X+ cWord=(unsigned char)(iStyle>>16); X+ cMeaning=(unsigned char)(iStyle>>8); X+ cMark=(unsigned char)iStyle; X g_print("flag: %c %c %c\n",cIndex,cWord,cMeaning); X X // mmap the file to memory X- caddr_t pFileMem=(caddr_t)mmap( (caddr_t)0,iFileSize-sizeof(int)*2, X+ pFileMem=(caddr_t)mmap( (caddr_t)0,iFileSize-sizeof(int)*2, X PROT_READ,MAP_SHARED|MAP_NORESERVE,fd,0 ); X if(pFileMem==MAP_FAILED) X { X@@ -133,9 +156,7 @@ X } X X // begin to read items. X- caddr_t p=pFileMem; X- caddr_t pMeaning, pMark; X- gchar *utf8_str; X+ p=pFileMem; X #ifndef DISABLE_CONVERT_LOCALE X gchar *locale_str; X gsize locale_write_size; X@@ -157,14 +178,7 @@ X return;*/ X X #endif X- gsize write_size; X- long tmp_long,wordcount=0; X- int word_len, meaning_len,mark_len=0; X- int iLength=0; X- X- GArray *array = g_array_sized_new(FALSE,FALSE, sizeof(struct _worditem),iCapacity); X- struct _worditem worditem; X- glong old_size; X+ array = g_array_sized_new(FALSE,FALSE, sizeof(struct _worditem),iCapacity); X X while(ppdata,parray->len,sizeof(gpointer),comparefunc,NULL); X g_array_sort(array,comparefunc); X X- long offset_old=0; X- X- int i; X- X- gchar *previous_word = g_strdup(""); //there should have no word equal this. X- glong previous_datasize = 0; X- gchar *previous_data = g_strdup(""); X- struct _worditem *pworditem; X for (i=0;ilen;i++) X { X pworditem = &g_array_index(array, struct _worditem, i); END-of-stardict2/files/patch-src::tools::olddic2newdic.c echo x - stardict2/files/patch-src::tools::oxford2dic.c sed 's/^X//' >stardict2/files/patch-src::tools::oxford2dic.c << 'END-of-stardict2/files/patch-src::tools::oxford2dic.c' X--- src/tools/oxford2dic.c.orig Mon May 5 04:05:50 2003 X+++ src/tools/oxford2dic.c Mon May 5 04:08:14 2003 X@@ -24,6 +24,19 @@ X { X struct stat stats; X FILE *oxfile,*idxfile,*dicfile; X+ gchar *buffer; X+ gchar *p1,*p2; X+ glong line_num = 0; X+ gchar *utf_str; X+ gsize write_size; X+ struct _worditem worditem; X+ GArray *array; X+ glong tmpglong=0; X+ long offset_old; X+ glong wordcount; X+ glong i; X+ gchar *previous_word = ""; X+ struct _worditem *pworditem; X X if (stat (filename, &stats) == -1) X { X@@ -32,21 +45,15 @@ X } X oxfile = fopen(filename,"r"); X X- gchar *buffer; X buffer = (gchar *)g_malloc (stats.st_size + 2); X fread (buffer, 1, stats.st_size, oxfile); X fclose (oxfile); X buffer[stats.st_size] = '\n'; X buffer[stats.st_size+1] = '\0'; X X- GArray *array = g_array_sized_new(FALSE,FALSE, sizeof(struct _worditem),39000); //oxford.txt have 77304 lines. X- struct _worditem worditem; X+ array = g_array_sized_new(FALSE,FALSE, sizeof(struct _worditem),39000); //oxford.txt have 77304 lines. X X- gchar *p1,*p2; X- glong line_num = 0; X p1 = buffer; X- gchar *utf_str; X- gsize write_size; X X while (1) { X if (*p1=='\0') { X@@ -91,17 +98,11 @@ X idxfile = fopen("oxford.idxdata","w"); X dicfile = fopen("oxford.dict","w"); X X- glong tmpglong=0; X fwrite(&(tmpglong),sizeof(glong),1,idxfile); X X X X- long offset_old; X- X- glong wordcount = array->len; X- glong i; X- gchar *previous_word = ""; X- struct _worditem *pworditem; X+ wordcount = array->len; X for (i=0;ilen;i++) X { X pworditem = &g_array_index(array, struct _worditem, i); END-of-stardict2/files/patch-src::tools::oxford2dic.c echo x - stardict2/files/patch-src::tools::pydict2dic.c sed 's/^X//' >stardict2/files/patch-src::tools::pydict2dic.c << 'END-of-stardict2/files/patch-src::tools::pydict2dic.c' X--- src/tools/pydict2dic.c.orig Fri Apr 25 18:55:55 2003 X+++ src/tools/pydict2dic.c Mon May 5 04:10:27 2003 X@@ -24,6 +24,20 @@ X { X struct stat stats; X FILE *pyfile,*ecidxfile,*ecdicfile,*ceidxfile,*cedicfile; X+ gchar *buffer; X+ GArray *ecarray; X+ struct _worditem ecworditem; X+ GArray *cearray; X+ struct _worditem ceworditem; X+ gchar *p1,*p2,*p3,*p4; X+ gchar *utf_str; X+ gsize write_size; X+ glong word_len; X+ long offset_old; X+ glong wordcount; X+ glong i; X+ gchar *previous_word = ""; X+ struct _worditem *pworditem; X X if (stat (filename, &stats) == -1) X { X@@ -32,24 +46,17 @@ X } X pyfile = fopen(filename,"r"); X X- gchar *buffer; X buffer = (gchar *)g_malloc (stats.st_size + 2); X fread (buffer, 1, stats.st_size, pyfile); X fclose (pyfile); X buffer[stats.st_size] = '\n'; X buffer[stats.st_size+1] = '\0'; X X- GArray *ecarray = g_array_sized_new(FALSE,FALSE, sizeof(struct _worditem),177785); //pydict.lib have 177785 lines. X- struct _worditem ecworditem; X- GArray *cearray = g_array_sized_new(FALSE,FALSE, sizeof(struct _worditem),177785); X- struct _worditem ceworditem; X+ ecarray = g_array_sized_new(FALSE,FALSE, sizeof(struct _worditem),177785); //pydict.lib have 177785 lines. X+ cearray = g_array_sized_new(FALSE,FALSE, sizeof(struct _worditem),177785); X X- gchar *p1,*p2,*p3,*p4; X p1 = buffer; X- gchar *utf_str; X- gsize write_size; X- glong word_len; X- X+ X while (1) { X if (*p1=='\0') { X g_print("over\n"); X@@ -142,12 +149,6 @@ X fprintf(ceidxfile,"stardict's idx file\ndictfile=pydict-big5-ce.dict\nbookname=pydict-big5-ce\nbeigin:\n"); X */ X X- long offset_old; X- X- glong wordcount; X- glong i; X- gchar *previous_word = ""; X- struct _worditem *pworditem; X X wordcount = ecarray->len; X for (i=0;ilen;i++) END-of-stardict2/files/patch-src::tools::pydict2dic.c exit State-Changed-From-To: open->closed State-Changed-By: vanilla State-Changed-When: Mon May 12 18:38:45 PDT 2003 State-Changed-Why: Committed, thanks. http://www.freebsd.org/cgi/query-pr.cgi?pr=51185 >Unformatted: