[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[palm-unix-j:00242] Re: pilot-link Japanese patch?
- Subject: [palm-unix-j:00242] Re: pilot-link Japanese patch?
- From: Tamito KAJIYAMA <kajiyama@grad.sccs.chukyo-u.ac.jp>
- Date: Fri, 23 Feb 2001 08:24:46 +0900
- In-reply-to: <E14UhDy-0000ga-00@triton2> (message from Hiroshi MIURA on Mon,19 Feb 2001 12:42:55 +0900)
梶山です。
Hiroshi MIURA <miura@da-cha.org> writes:
|
| もし、
| #ifdef USING_JAPANESE
| ...
| #endif
| で囲まれた形でL10Nしたのであれば、./configure --use-japanese
| のようにすることで、日本語版とオリジナルとをマージできるのでは
| ないでしょうか。
|
| そこまでやっていただけると、日本の主要Linuxディストリビューションや
| FreeBSDに取り入れてもらえるのではないかとおもいますが
|
| # オリジナルの作者にpatchをおくるとか。
上記のように L10N したことはしたんですが、あまりに quick & dirty
な実装なので原作者に送るのは申し訳ない気がしています。
| > パッチが必要な方はおっしゃっていただければお送りします (需要が
| > なさそうなのでとりあえずここには流さないことにします)。
|
| 需要はわからないのではないでしょうか。あれば使う人はいると思いますよ。
| わたしもあるなら使いたい。
私以外に少なくとも一人は使いたいと言う人がいるということで、以下
に pilot-xfer 0.9.3 と makedoc 0.7a に対する EUC-JP パッチを公開
します。無保証です。配布条件はオリジナルのそれに従うことにします。
pilot-link の方は configure に --enable-euc-jp オプションを指定
することで EUC-JP パッチを有効にすることができます。修正されてい
るのは pilot-xfer コマンドと install-memo コマンドのみです。効能
は以下の通り:
pilot-xfer:
- 標準出力に表示される日本語が正しく表示される。
- -f(etch) と -d(elete) に指定する dbname に日本語を使える。
- -e(xclude) に指定するファイルの内容を EUC-JP で書ける。
install-memo:
- -c オプションに指定するカテゴリ名に日本語を使える。
- メモの本文が Shift JIS でなければならない点は変わっていない。
makedoc の方は -DEUC_JP を付けてコンパイルして下さい。コマンドラ
インで指定するタイトル (story-name) に日本語を使えるようになりま
す。同期したときに作られるバックアップのファイル名が日本語になる
ので、それが嫌な人は英文字のタイトルを付けるのがいいと思います。
--
KAJIYAMA, Tamito <kajiyama@grad.sccs.chukyo-u.ac.jp>
diff -ru pilot-link.0.9.3.orig/configure pilot-link.0.9.3/configure
--- pilot-link.0.9.3.orig/configure Fri May 14 15:52:43 1999
+++ pilot-link.0.9.3/configure Fri Feb 23 07:29:16 2001
@@ -35,6 +35,8 @@
--with-java=jdkbase use Java [default=yes]"
ac_help="$ac_help
--with-perl5=perl5exec use Perl5 [default=yes]"
+ac_help="$ac_help
+ --enable-euc-jp enable EUC-JP support"
# Initialize some variables set by options.
# The variables have the same names as the options, with
@@ -2933,6 +2935,14 @@
if test $ac_cv_prog_cxx_works = yes; then
cc_m='libcc/Makefile'
fi
+
+# Check whether --enable-euc-jp or --disable-euc-jp was given.
+if test "${enable_euc_jp+set}" = set; then
+ enableval="$enable_euc_jp"
+ CFLAGS="$CFLAGS -DEUC_JP"
+
+fi
+
diff -ru pilot-link.0.9.3.orig/configure.in pilot-link.0.9.3/configure.in
--- pilot-link.0.9.3.orig/configure.in Sat May 8 04:01:15 1999
+++ pilot-link.0.9.3/configure.in Fri Feb 23 07:33:03 2001
@@ -563,6 +563,8 @@
cc_m='libcc/Makefile'
fi
+AC_ARG_ENABLE(euc-jp, [ --enable-euc-jp enable EUC-JP support], CFLAGS="$CFLAGS -DEUC_JP")
+
AC_SUBST(WITHTCL)
AC_SUBST(WITHJAVA)
AC_SUBST(WITHTK)
diff -ru pilot-link.0.9.3.orig/install-memo.c pilot-link.0.9.3/install-memo.c
--- pilot-link.0.9.3.orig/install-memo.c Sun Sep 20 09:12:28 1998
+++ pilot-link.0.9.3/install-memo.c Fri Feb 23 07:26:05 2001
@@ -11,6 +11,32 @@
#include "pi-dlp.h"
#include "pi-memo.h"
+#ifdef EUC_JP
+static unsigned char *
+euc2sjis(unsigned char *s)
+{
+ unsigned char *p;
+
+ p = s = strdup(s);
+ while (*p) {
+ if (*p < 0x80) {
+ p++;
+ } else if (*p & 1) {
+ *p = *p / 2 + ((*p < 0xdf) ? 0x31 : 0x71);
+ p++;
+ *p = *p - ((*p >= 0xe0) ? 0x60 : 0x61);
+ p++;
+ } else {
+ *p = *p / 2 + ((*p < 0xdf) ? 0x30 : 0x70);
+ p++;
+ *p = *p - 2;
+ p++;
+ }
+ }
+ return s;
+}
+#endif
+
extern char* optarg;
extern int optind;
@@ -43,6 +69,9 @@
struct MemoAppInfo mai;
int ch;
char *progname, *category_name;
+#ifdef EUC_JP
+ char *category_name_in_euc;
+#endif
int preamble, quiet, replace_category, add_title;
progname = argv[0];
@@ -58,7 +87,12 @@
while ((ch = getopt(argc, argv, "c:p:qrt")) != -1)
switch (ch) {
case 'c':
+#ifdef EUC_JP
+ category_name_in_euc = optarg;
+ category_name = euc2sjis(optarg);
+#else
category_name = optarg;
+#endif
break;
case 'p':
/* optarg is name of port to use instead of $PILOTPORT or /dev/pilot */
@@ -140,13 +174,21 @@
if (category_name) {
category = -1; /* invalid category */
for (i = 0; i < 16; i++)
+#ifdef EUC_JP
+ if (!strcmp(mai.category.name[i], category_name)) {
+#else
if (!strcasecmp(mai.category.name[i], category_name)) {
+#endif
category = i;
break;
}
if (category < 0) {
fprintf(stderr, "%s: category %s not found on PalmPilot\n",
+#ifdef EUC_JP
+ progname, category_name_in_euc);
+#else
progname, category_name);
+#endif
exit(2);
}
diff -ru pilot-link.0.9.3.orig/pilot-xfer.c pilot-link.0.9.3/pilot-xfer.c
--- pilot-link.0.9.3.orig/pilot-xfer.c Mon Apr 26 14:50:11 1999
+++ pilot-link.0.9.3/pilot-xfer.c Fri Feb 23 07:26:05 2001
@@ -29,6 +29,56 @@
#include "pi-dlp.h"
#include "pi-version.h"
+#ifdef EUC_JP
+static unsigned char *
+euc2sjis(unsigned char *s)
+{
+ unsigned char *p;
+
+ p = s = strdup(s);
+ while (*p) {
+ if (*p < 0x80) {
+ p++;
+ } else if (*p & 1) {
+ *p = *p / 2 + ((*p < 0xdf) ? 0x31 : 0x71);
+ p++;
+ *p = *p - ((*p >= 0xe0) ? 0x60 : 0x61);
+ p++;
+ } else {
+ *p = *p / 2 + ((*p < 0xdf) ? 0x30 : 0x70);
+ p++;
+ *p = *p - 2;
+ p++;
+ }
+ }
+ return s;
+}
+
+static unsigned char *
+sjis2euc(unsigned char *s)
+{
+ unsigned char *p;
+
+ p = s = strdup(s);
+ while (*p) {
+ if (*p < 0x80) {
+ p++;
+ } else if (*(p+1) >= 0x9f ) {
+ *p = *p * 2 - ((*p >= 0xe0) ? 0xe0 : 0x60);
+ p++;
+ *p = *p + 2;
+ p++;
+ } else {
+ *p = *p * 2 - ((*p >= 0xe0) ? 0xe1 : 0x61);
+ p++;
+ *p = *p + ((*p >= 0x7f) ? 0x60 : 0x61);
+ p++;
+ }
+ }
+ return s;
+}
+#endif
+
#define pi_mktag(c1,c2,c3,c4) (((c1)<<24)|((c2)<<16)|((c3)<<8)|(c4))
int sd = 0;
@@ -54,7 +104,11 @@
if (temp[strlen(temp)-1] == '\n')
temp[strlen(temp)-1] = '\0';
printf("Will exclude: %s\n",temp);
+#ifdef EUC_JP
+ exclude[numexclude++] = euc2sjis(temp);
+#else
exclude[numexclude++] = strdup(temp);
+#endif
}
}
@@ -215,13 +269,21 @@
i = info.index + 1;
if (dlp_OpenConduit(sd)<0) {
+#ifdef EUC_JP
+ fprintf(stderr, "Exiting on cancel, all data _not_ backed up, stopped before backing up '%s'.\n", sjis2euc(info.name));
+#else
fprintf(stderr, "Exiting on cancel, all data _not_ backed up, stopped before backing up '%s'.\n", info.name);
+#endif
exit(1);
}
strcpy(name, dirname);
strcat(name, "/");
+#ifdef EUC_JP
+ protect_name(name + strlen(name), sjis2euc(info.name));
+#else
protect_name(name + strlen(name), info.name);
+#endif
if (info.flags & dlpDBFlagResource)
strcat(name,".prc");
@@ -243,7 +305,11 @@
if (only_changed) {
if (stat(name, &statb) == 0) {
if (info.modifyDate == statb.st_mtime) {
+#ifdef EUC_JP
+ printf("No change, skipping '%s'.\n", sjis2euc(info.name));
+#else
printf("No change, skipping '%s'.\n", info.name);
+#endif
RemoveFromList(name, orig_files, ofile_total);
continue;
}
@@ -309,7 +375,11 @@
exit(1);
}
+#ifdef EUC_JP
+ if (dlp_FindDBInfo(sd, 0, 0, euc2sjis(dbname), 0, 0, &info)<0) {
+#else
if (dlp_FindDBInfo(sd, 0, 0, dbname, 0, 0, &info)<0) {
+#endif
printf("Unable to locate database '%s', fetch skipped.\n", dbname);
return;
}
@@ -350,10 +420,18 @@
exit(1);
}
+#ifdef EUC_JP
+ dlp_FindDBInfo(sd, 0, 0, euc2sjis(dbname), 0, 0, &info);
+#else
dlp_FindDBInfo(sd, 0, 0, dbname, 0, 0, &info);
+#endif
printf("Deleting '%s'... ", dbname);
+#ifdef EUC_JP
+ if (dlp_DeleteDB(sd, 0, euc2sjis(dbname))>=0) {
+#else
if (dlp_DeleteDB(sd, 0, dbname)>=0) {
+#endif
if (info.type == pi_mktag('b','o','o','t')) {
printf(" (rebooting afterwards) ");
}
@@ -580,7 +658,11 @@
break;
i = info.index + 1;
+#ifdef EUC_JP
+ printf("'%s'\n", sjis2euc(info.name));
+#else
printf("'%s'\n", info.name);
+#endif
}
printf("List done.\n");
@@ -610,7 +692,11 @@
if (info.flags & 1)
continue; /* skip resource databases */
+#ifdef EUC_JP
+ printf("Purging deleted records from '%s'... ", sjis2euc(info.name));
+#else
printf("Purging deleted records from '%s'... ", info.name);
+#endif
h = 0;
if ((dlp_OpenDB(sd, 0, 0x40|0x80, info.name, &h)>=0) &&
--- makedoc7.cpp.orig Sun Feb 18 05:58:57 2001
+++ makedoc7.cpp Sun Feb 18 05:56:19 2001
@@ -81,6 +81,32 @@
DWORD dwSpare2;
};
+#ifdef EUC_JP
+static unsigned char *
+euc2sjis(unsigned char *s)
+{
+ unsigned char *p;
+
+ p = s = (unsigned char *)strdup((const char *)s);
+ while (*p) {
+ if (*p < 0x80) {
+ p++;
+ } else if (*p & 1) {
+ *p = *p / 2 + ((*p < 0xdf) ? 0x31 : 0x71);
+ p++;
+ *p = *p - ((*p >= 0xe0) ? 0x60 : 0x61);
+ p++;
+ } else {
+ *p = *p / 2 + ((*p < 0xdf) ? 0x30 : 0x70);
+ p++;
+ *p = *p - 2;
+ p++;
+ }
+ }
+ return s;
+}
+#endif
+
////////////// utilities //////////////////////////////////////
WORD SwapWord21(WORD r)
@@ -647,7 +673,11 @@
long recSize = 4096;
DWORD z,numRecs;
+#ifdef EUC_JP
+ sprintf(head1.sName,"%.31s",euc2sjis((unsigned char *)argv[iArg+2]));
+#else
sprintf(head1.sName,"%.31s",argv[iArg+2]);
+#endif
head1.sName[31] = 0;
printf("saving to %s as <%s>,%s%s compressed",argv[iArg+1],argv[iArg+2],
bBinary ? " binary mode," : "",