|
|
3cc08b8 |
diff -U0 texlive-2016/source/texk/upmendex/ChangeLog.than texlive-2016/source/texk/upmendex/ChangeLog
|
|
|
3cc08b8 |
--- texlive-2016/source/texk/upmendex/ChangeLog.than 2017-03-08 15:14:32.529825017 +0100
|
|
|
3cc08b8 |
+++ texlive-2016/source/texk/upmendex/ChangeLog 2017-03-08 15:17:34.235944067 +0100
|
|
|
3cc08b8 |
@@ -0,0 +1,6 @@
|
|
|
3cc08b8 |
+2016-06-19 TANAKA Takuji <ttk@t-lab.opal.ne.jp>
|
|
|
3cc08b8 |
+
|
|
|
3cc08b8 |
+ * version 0.51 Beta version.
|
|
|
3cc08b8 |
+ * fwrite.c: Fix bug of option "hanzi_head" in style file.
|
|
|
3cc08b8 |
+ Thanks to Dr. Werner Fink.
|
|
|
3cc08b8 |
+
|
|
|
3cc08b8 |
diff -up texlive-2016/source/texk/upmendex/fwrite.c.than texlive-2016/source/texk/upmendex/fwrite.c
|
|
|
3cc08b8 |
--- texlive-2016/source/texk/upmendex/fwrite.c.than 2017-03-08 15:13:29.460213372 +0100
|
|
|
3cc08b8 |
+++ texlive-2016/source/texk/upmendex/fwrite.c 2017-03-08 15:17:34.235944067 +0100
|
|
|
3cc08b8 |
@@ -67,33 +67,38 @@ static inline int SAPPENDF(char *buf, co
|
|
|
3cc08b8 |
|
|
|
3cc08b8 |
static void fprint_uchar(FILE *fp, const UChar *a, const int mode, const int len)
|
|
|
3cc08b8 |
{
|
|
|
3cc08b8 |
- int k;
|
|
|
3cc08b8 |
- char str[15], *ret;
|
|
|
3cc08b8 |
- UChar istr[5];
|
|
|
3cc08b8 |
+ char str[3*INITIALLENGTH+1];
|
|
|
3cc08b8 |
+ UChar istr[INITIALLENGTH];
|
|
|
3cc08b8 |
int olen, wclen;
|
|
|
3cc08b8 |
UErrorCode perr;
|
|
|
3cc08b8 |
|
|
|
3cc08b8 |
if (len<0) {
|
|
|
3cc08b8 |
- for (k=0; a[k] || k<4; k++) istr[k]=a[k];
|
|
|
3cc08b8 |
- wclen=k;
|
|
|
3cc08b8 |
+ u_strcpy(istr,a);
|
|
|
3cc08b8 |
+ wclen=u_strlen(istr);
|
|
|
3cc08b8 |
} else {
|
|
|
3cc08b8 |
- wclen = is_surrogate_pair(a) ? 2 : 1;
|
|
|
3cc08b8 |
+ wclen=is_surrogate_pair(a) ? 2 : 1;
|
|
|
3cc08b8 |
istr[0]=a[0];
|
|
|
3cc08b8 |
if (wclen==2) istr[1]=a[1];
|
|
|
3cc08b8 |
+ istr[wclen]=L'\0';
|
|
|
3cc08b8 |
}
|
|
|
3cc08b8 |
- istr[wclen]=L'\0';
|
|
|
3cc08b8 |
if (mode==M_TO_UPPER) {
|
|
|
3cc08b8 |
- perr = U_ZERO_ERROR;
|
|
|
3cc08b8 |
- u_strToUpper(istr,5,istr,wclen,"",&perr;;
|
|
|
3cc08b8 |
+ perr=U_ZERO_ERROR;
|
|
|
3cc08b8 |
+ olen=u_strToUpper(istr,INITIALLENGTH,istr,wclen,"",&perr;;
|
|
|
3cc08b8 |
} else if (mode==M_TO_LOWER) {
|
|
|
3cc08b8 |
- perr = U_ZERO_ERROR;
|
|
|
3cc08b8 |
- u_strToLower(istr,5,istr,wclen, istr[0]==0x130&&turkish_i?"tr":"", &perr;;
|
|
|
3cc08b8 |
+ perr=U_ZERO_ERROR;
|
|
|
3cc08b8 |
+ olen=u_strToLower(istr,INITIALLENGTH,istr,wclen, istr[0]==0x130&&turkish_i?"tr":"", &perr;;
|
|
|
3cc08b8 |
} else if (mode==M_TO_TITLE) {
|
|
|
3cc08b8 |
- perr = U_ZERO_ERROR;
|
|
|
3cc08b8 |
- u_strToTitle(istr,5,istr,wclen,NULL,"",&perr;;
|
|
|
3cc08b8 |
- }
|
|
|
3cc08b8 |
- perr = U_ZERO_ERROR;
|
|
|
3cc08b8 |
- ret = u_strToUTF8(str, 15, &olen, istr, wclen, &perr;;
|
|
|
3cc08b8 |
+ perr=U_ZERO_ERROR;
|
|
|
3cc08b8 |
+ olen=u_strToTitle(istr,INITIALLENGTH,istr,wclen,NULL,"",&perr;;
|
|
|
3cc08b8 |
+ } else
|
|
|
3cc08b8 |
+ olen=wclen;
|
|
|
3cc08b8 |
+ if (olen>INITIALLENGTH) {
|
|
|
3cc08b8 |
+ warn_printf(efp, "\nWarning, Too long (%d) header.\n", olen);
|
|
|
3cc08b8 |
+ wclen=INITIALLENGTH;
|
|
|
3cc08b8 |
+ } else
|
|
|
3cc08b8 |
+ wclen=olen;
|
|
|
3cc08b8 |
+ perr=U_ZERO_ERROR;
|
|
|
3cc08b8 |
+ u_strToUTF8(str, 3*INITIALLENGTH+1, &olen, istr, wclen, &perr;;
|
|
|
3cc08b8 |
fprintf(fp,"%s",str);
|
|
|
3cc08b8 |
}
|
|
|
3cc08b8 |
|
|
|
3cc08b8 |
@@ -844,7 +849,7 @@ static int initial_cmp_char(UChar *ini,
|
|
|
3cc08b8 |
static int init_hanzi_header(void)
|
|
|
3cc08b8 |
{
|
|
|
3cc08b8 |
UChar strX[2],*pch0,*pch1;
|
|
|
3cc08b8 |
- int k, hzmode;
|
|
|
3cc08b8 |
+ int k, hzmode, len;
|
|
|
3cc08b8 |
struct hanzi_index *hz_idx_init;
|
|
|
3cc08b8 |
|
|
|
3cc08b8 |
strX[0]=0x5B57; strX[1]=L'\0';
|
|
|
3cc08b8 |
@@ -878,21 +883,18 @@ static int init_hanzi_header(void)
|
|
|
3cc08b8 |
for (k=0;k
|
|
|
3cc08b8 |
if (u_strlen(pch0)==0) break;
|
|
|
3cc08b8 |
if ((pch1=u_strchr(pch0,L';'))>0) {
|
|
|
3cc08b8 |
- if (pch1-pch0>=INITIALLENGTH) {
|
|
|
3cc08b8 |
- warn_printf(efp, "\nWarning, Too long hanzi header.\n");
|
|
|
3cc08b8 |
- break;
|
|
|
3cc08b8 |
- }
|
|
|
3cc08b8 |
- u_strncpy(hz_index[k].idx,pch0,pch1-pch0);
|
|
|
3cc08b8 |
- hz_index[k].idx[pch1-pch0]=L'\0';
|
|
|
3cc08b8 |
- pch0=pch1+1;
|
|
|
3cc08b8 |
+ len=pch1-pch0;
|
|
|
3cc08b8 |
} else {
|
|
|
3cc08b8 |
- if (u_strlen(pch0)>=INITIALLENGTH) {
|
|
|
3cc08b8 |
- warn_printf(efp, "\nWarning, Too long hanzi header.\n");
|
|
|
3cc08b8 |
- break;
|
|
|
3cc08b8 |
- }
|
|
|
3cc08b8 |
- u_strcpy(hz_index[k].idx,pch0);
|
|
|
3cc08b8 |
- break;
|
|
|
3cc08b8 |
+ len=u_strlen(pch0);
|
|
|
3cc08b8 |
}
|
|
|
3cc08b8 |
+ if (len>=INITIALLENGTH) {
|
|
|
3cc08b8 |
+ warn_printf(efp, "\nWarning, Too long (%d) hanzi header.\n", len);
|
|
|
3cc08b8 |
+ len=INITIALLENGTH-1;
|
|
|
3cc08b8 |
+ }
|
|
|
3cc08b8 |
+ u_strncpy(hz_index[k].idx,pch0,len);
|
|
|
3cc08b8 |
+ hz_index[k].idx[len]=L'\0';
|
|
|
3cc08b8 |
+ if (pch1>0) pch0=pch1+1;
|
|
|
3cc08b8 |
+ else break;
|
|
|
3cc08b8 |
}
|
|
|
3cc08b8 |
|
|
|
3cc08b8 |
return hzmode;
|
|
|
3cc08b8 |
diff -up texlive-2016/source/texk/upmendex/main.c.than texlive-2016/source/texk/upmendex/main.c
|
|
|
3cc08b8 |
--- texlive-2016/source/texk/upmendex/main.c.than 2017-03-08 15:13:49.460455992 +0100
|
|
|
3cc08b8 |
+++ texlive-2016/source/texk/upmendex/main.c 2017-03-08 15:17:34.236944029 +0100
|
|
|
3cc08b8 |
@@ -19,7 +19,7 @@ char *styfile,*idxfile[256],*indfile,*di
|
|
|
3cc08b8 |
#endif
|
|
|
3cc08b8 |
KpathseaSupportInfo kp_ist,kp_dict;
|
|
|
3cc08b8 |
|
|
|
3cc08b8 |
-#define VERSION "version 0.50"
|
|
|
3cc08b8 |
+#define VERSION "version 0.51"
|
|
|
3cc08b8 |
|
|
|
3cc08b8 |
int main(int argc, char **argv)
|
|
|
3cc08b8 |
{
|