namazu-ml(avocado)


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: patch for kakasi-2.2.5 on OS/2 (and Win32)



清水@住友林業です。

kakasi-2.2.5 で辞書ファイルの位置を環境変数から取得できるように
するパッチですが、マジメに cast させた版を流します。

Win32 版はこっちでマージしてくださいませ。

--

%diff -c src.orig/dict.c os2src/dict.c
*** src.orig/dict.c	Sun Jun 19 17:05:46 1994
--- os2src/dict.c	Tue Feb 24 16:55:56 1998
***************
*** 28,34 ****
--- 28,38 ----
  #include <stdio.h>
  #include <ctype.h>
  #include <string.h>
+ #ifdef emx
+ #include <stdlib.h>
+ #else
  #include <malloc.h>
+ #endif
  #include "kakasi.h"
  #include "J2.h"
  
***************
*** 181,187 ****
      int tail;
      extern char *ialloc();
  
!     if ((jisyo_fp = fopen(filename, "r")) == NULL) {
  	perror(filename);
  	exit(0);
      }
--- 185,191 ----
      int tail;
      extern char *ialloc();
  
!     if ((jisyo_fp = fopen(filename, "rb")) == NULL) {
  	perror(filename);
  	exit(0);
      }
***************
*** 246,259 ****
  void init_kanwa()
  {
      int i, j;
      
!     if ((kanwadict = fopen(KANWADICT,"r")) == NULL) {
! 	perror(KANWADICT);
  	exit(2);
      }
  
      if (fread((char *)kanwa, sizeof kanwa, 1, kanwadict) != 1) {
! 	perror(KANWADICT);
      }
  
      for (i = 0; i < 0x80; ++ i)
--- 250,271 ----
  void init_kanwa()
  {
      int i, j;
+ 
+     char *kanwadictpath;
+     
+     kanwadictpath = (char*)getenv("KANWADICTPATH");
+     if (kanwadictpath == (char*)NULL)
+         kanwadictpath = (char*)getenv("KANWADICT");
+     if (kanwadictpath == (char*)NULL)
+ 	kanwadictpath = KANWADICT;
      
!     if ((kanwadict = fopen(kanwadictpath,"rb")) == NULL) {
! 	perror(kanwadictpath);
  	exit(2);
      }
  
      if (fread((char *)kanwa, sizeof kanwa, 1, kanwadict) != 1) {
! 	perror(kanwadictpath);
      }
  
      for (i = 0; i < 0x80; ++ i)

%diff -c src.orig/itaiji.c os2src/itaiji.c
*** src.orig/itaiji.c	Sun Jun 19 17:05:32 1994
--- os2src/itaiji.c	Tue Feb 24 16:56:46 1998
***************
*** 43,54 ****
      int i, j;
      char buffer[BUFSIZE];
      unsigned char n1, n2, o1, o2;
      
!     if ((fp = fopen(ITAIJIDICT, "r")) == NULL) {
  	fprintf(stderr, "Can't open Kanji itaijidict file ");
! 	perror(ITAIJIDICT);
  	exit(0);
      }
      for (i = 0; i < 0x80; ++ i) {
  	for (j = 0; j < 0x80; ++ j) {
  	    ittbl1[i][j] = i | 0x80;
--- 43,63 ----
      int i, j;
      char buffer[BUFSIZE];
      unsigned char n1, n2, o1, o2;
+ 
+     char *itaijidictpath;
      
!     itaijidictpath = (char*)getenv("ITAIJIDICTPATH");
!     if (itaijidictpath == (char*)NULL)
!         itaijidictpath = (char*)getenv("ITAIJIDICT");
!     if (itaijidictpath == (char*)NULL)
! 	itaijidictpath = ITAIJIDICT;
! 
!     if ((fp = fopen(itaijidictpath, "rb")) == NULL) {
  	fprintf(stderr, "Can't open Kanji itaijidict file ");
! 	perror(itaijidictpath);
  	exit(0);
      }
+ 
      for (i = 0; i < 0x80; ++ i) {
  	for (j = 0; j < 0x80; ++ j) {
  	    ittbl1[i][j] = i | 0x80;


end
--
  住友林業株式会社  情報システム部   清水 和佳
 
  TEL: +81-3-5322-6672  FAX: +81-3-5322-6658  Niftyserve: XLW01034
  e-mail: <kshimz@xxxxxxxxx>