Annotation of OpenXM/src/asir-doc/jtexindex/C/jtexindex.diff, Revision 1.1
1.1 ! noro 1: Path: kddlab!cs.titech!wnoc-tyo-news!sh.wide!wnoc-kyo!oskgate0.mei!synapse!kgway!manmos
! 2: From: manmos@knowledge.co.jp (Hideo "Sir MaNMOS" Morisita)
! 3: Newsgroups: fj.sources
! 4: Subject: Japanese extention for texindex
! 5: Message-ID: <MANMOS.93Jul13113502@kgway.knowledge.co.jp>
! 6: Date: 13 Jul 93 02:35:02 GMT
! 7: Sender: manmos@kgway.knowledge.co.jp
! 8: Followup-To: fj.sources.d
! 9: Distribution: fj
! 10: Organization: Knowledge. Co., Osaka, Japan
! 11: Lines: 643
! 12:
! 13:
! 14: $B?92<(J $B$*Be41MM(J $B#M#a#N#M#O#S!w%J%l%C%8$G$9!#(J
! 15:
! 16: $B0JA0!"(Jtexinfo$B$NF|K\8l3HD%$,(Jfj$B$KN.$l$^$7$?$,!"$=$lMQ$N(Jtexindex$B$ON.$l$J(J
! 17: $B$+$C$?$h$&$G$9$N$G!":n$C$F$_$^$7$?!#(J
! 18:
! 19: texindex.c 1.45$B$N3HD%$H$7$F:n$C$F$"$j$^$9!#(J(texindex.c 1.45$B$O(J
! 20: texinfo-2.15 $B$+$i(J texinfo-3.0$B$^$GF1$8$b$N$G$9(J)
! 21:
! 22: $B;HMQJ}K!$O(J
! 23:
! 24: patch < $B$3$N%U%!%$%k(J
! 25:
! 26: $B$H$7!"(JMakefile$B$N(J DEFS$B$N=j$K(J -DEUC or -DSJIS$B$rDj5A$7$F%3%s%Q%$%k$7$F2<(J
! 27: $B$5$$!#(J
! 28:
! 29: $B%$%s%G%C%/%9=g$O(J
! 30:
! 31: ASCII$B5-9f(J->ASCII & JIS208 $B?t;z(J -> ASCII & JIS208 $B%"%k%U%!%Y%C%H(J ->
! 32: JIS201 & JIS208 $B2>L>(J
! 33:
! 34: $B$K$J$C$F$$$^$9!#(J
! 35:
! 36: $B8+=P$7$O!"2>L>#1J8;z$E$D$K$J$C$F$$$^$9!#!J$"9T$+9T$H$+$G$J$$!"$=$&$9$k(J
! 37: $B$N$b%F!<%V%k$r:n$l$PFq$7$/$O$J$$$G$9$,!D!K(J
! 38:
! 39: --------------------------------(cur me)-----------------------------
! 40: *** texindex.c Sat Dec 12 01:19:49 1992
! 41: --- jtexindex.c Tue Jul 13 11:15:17 1993
! 42: ***************
! 43: *** 1,6 ****
! 44: /* Prepare TeX index dribble output into an actual index.
! 45:
! 46: ! Version 1.45
! 47:
! 48: Copyright (C) 1987, 1991, 1992 Free Software Foundation, Inc.
! 49:
! 50: --- 1,6 ----
! 51: /* Prepare TeX index dribble output into an actual index.
! 52:
! 53: ! Version 1.45-j1.00
! 54:
! 55: Copyright (C) 1987, 1991, 1992 Free Software Foundation, Inc.
! 56:
! 57: ***************
! 58: *** 607,612 ****
! 59: --- 607,618 ----
! 60: while (bracelevel)
! 61: {
! 62: c = *p++;
! 63: + #ifdef SJIS
! 64: + if ( iskanji(c)) {
! 65: + p++;
! 66: + continue;
! 67: + }
! 68: + #endif
! 69: if (c == '{')
! 70: bracelevel++;
! 71: if (c == '}')
! 72: ***************
! 73: *** 650,655 ****
! 74: --- 656,667 ----
! 75: while (bracelevel)
! 76: {
! 77: c = *p++;
! 78: + #ifdef SJIS
! 79: + if (iskanji(c)) {
! 80: + p++;
! 81: + continue;
! 82: + }
! 83: + #endif
! 84: if (c == '{')
! 85: bracelevel++;
! 86: if (c == '}')
! 87: ***************
! 88: *** 678,685 ****
! 89: /* Vector used to translate characters for comparison.
! 90: This is how we make all alphanumerics follow all else,
! 91: and ignore case in the first sorting. */
! 92: ! int char_order[256];
! 93:
! 94: void
! 95: init_char_order ()
! 96: {
! 97: --- 690,1071 ----
! 98: /* Vector used to translate characters for comparison.
! 99: This is how we make all alphanumerics follow all else,
! 100: and ignore case in the first sorting. */
! 101: ! int char_order[0x10000]; /* japanese */
! 102: !
! 103: ! #ifdef EUC
! 104: ! #define KANJI
! 105: ! #endif
! 106: !
! 107: ! #ifdef SJIS
! 108: ! #define KANJI
! 109: ! #endif
! 110: !
! 111: ! #ifdef KANJI
! 112: !
! 113: ! #ifndef EUC
! 114: ! # ifndef SJIS
! 115: ! # define EUC
! 116: ! # endif
! 117: ! #else
! 118: ! # ifdef SJIS
! 119: ! # error
! 120: ! # endif
! 121: ! #endif
! 122: !
! 123: ! #ifdef EUC
! 124: ! #define JIS_NUM_0 0xa3b0
! 125: ! #define JIS_NUM_9 (JIS_NUM_0 + '9'- '0')
! 126: ! #define JIS_ALPH_A 0xa3c1
! 127: ! #define JIS_ALPH_Z (JIS_ALPH_A + 'Z'-'A')
! 128: ! #define JIS_ALPH_a 0xa3e1
! 129: ! #define JIS_HIRA_SMALL_A 0xa4a1
! 130: ! #define JIS_HIRA_NN 0xa4f3
! 131: ! #define JIS_KATA_SMALL_A 0xa5a1
! 132: ! #define JIS_KATA_SMALL_KE 0xa5f6
! 133: ! #define JIS_HIRA_U 0xa4a6
! 134: ! #define JIS_KATA_U 0xa5a6
! 135: ! #define JIS_KATA_VU 0xa5f4
! 136: !
! 137: ! #define JIS_KATA_UPPER 0xa5
! 138: ! #define JIS_HIRA_UPPER 0xa4
! 139: !
! 140: ! #define JIS_HIRA_A 0xa4a2
! 141: ! #define JIS_KATA_A 0xa5a2
! 142: !
! 143: ! #define JIS_DAKUTEN 0xa1ab
! 144: ! #define JIS_HANDAKUTEN 0xa1ac
! 145: ! #define JIS_CHOUON 0xa2ac
! 146: !
! 147: ! int kana[] = {
! 148: ! /* . [ ] , . wo a */
! 149: ! 0xa1a1, 0xa1a3, 0xa1d6, 0xa1d7, 0xa1a2, 0xa1a6, 0xa5f2, 0xa5a1,
! 150: ! /* i u e o ya yu yo tsu */
! 151: ! 0xa5a3, 0xa5a5, 0xa5a7, 0xa5a9, 0xa5e3, 0xa5e5, 0xa5e7, 0xa5c3,
! 152: ! /* - a i u e o ka ki */
! 153: ! 0xa1bc, 0xa5a2, 0xa5a4, 0xa5a6, 0xa5a8, 0xa5aa, 0xa5ab, 0xa5ad,
! 154: ! /* ku ke ko sa si su se so */
! 155: ! 0xa5af, 0xa5b1, 0xa5b3, 0xa5b5, 0xa5b7, 0xa5b9, 0xa5bb, 0xa5bd,
! 156: ! /* ta ti tu te to na ni nu */
! 157: ! 0xa5bf, 0xa5c1, 0xa5c4, 0xa5c6, 0xa5c8, 0xa5ca, 0xa5cb, 0xa5cc,
! 158: ! /* ne no ha hi hu he ho ma */
! 159: ! 0xa5cd, 0xa5ce, 0xa5cf, 0xa5d2, 0xa5d5, 0xa5d8, 0xa5db, 0xa5de,
! 160: ! /* mi mu me mo ya yu yo ra */
! 161: ! 0xa5df, 0xa5e0, 0xa5e1, 0xa5e2, 0xa5e4, 0xa5e6, 0xa5e8, 0xa5e9,
! 162: ! /* ri ru re ro wa nn "" maru */
! 163: ! 0xa5ea, 0xa5eb, 0xa5ec, 0xa5ed, 0xa5ef, 0xa5f3, JIS_DAKUTEN,JIS_HANDAKUTEN
! 164: ! };
! 165: !
! 166: ! int daku[] = {0xa5ac, 0xa5ae, 0xa5b0, 0xa5b2, 0xa5b4, /* $B%,(J*/
! 167: ! 0xa5b6, 0xa5b8, 0xa5ba, 0xa5bc, 0xa5be, /* $B%6(J */
! 168: ! 0xa5c0, 0xa5c2, 0xa5c5, 0xa5c7, 0xa5c9, /* $B%@(J */
! 169: ! 0xa5d0, 0xa5d3, 0xa5d6, 0xa5d9, 0xa5dc}; /* $B%P(J */
! 170: ! int handaku[] = {0xa5d1, 0xa5d4, 0xa5d7, 0xa5da, 0xa5dd}; /* $B%Q(J */
! 171: ! int dakuall[] = {0xa4ac, 0xa4ae, 0xa4b0, 0xa4b2, 0xa4b4, /* $B$,(J */
! 172: ! 0xa4b6, 0xa4b8, 0xa4ba, 0xa4bc, 0xa4be, /* $B$6(J */
! 173: ! 0xa4c0, 0xa4c2, 0xa4c5, 0xa4c7, 0xa4c9, /* $B$@(J */
! 174: ! 0xa4d0, 0xa4d3, 0xa4d6, 0xa4d9, 0xa4dc, /* $B$P(J */
! 175: ! 0xa5ac, 0xa5ae, 0xa5b0, 0xa5b2, 0xa5b4, /* $B%,(J */
! 176: ! 0xa5b6, 0xa5b8, 0xa5ba, 0xa5bc, 0xa5be, /* $B%6(J */
! 177: ! 0xa5c0, 0xa5c2, 0xa5c5, 0xa5c7, 0xa5c9, /* $B%@(J */
! 178: ! 0xa5d0, 0xa5d3, 0xa5d6, 0xa5d9, 0xa5dc}; /* $B%P(J */
! 179: ! int handakuall[] = {0xa4d1, 0xa4d4, 0xa4d7, 0xa4da, 0xa4dd, /* $B$Q(J */
! 180: ! 0xa5d1, 0xa5d4, 0xa5d7, 0xa5da, 0xa5dd}; /* $B%Q(J */
! 181: !
! 182: !
! 183: ! iskanji(c) /* japanses extention */
! 184: ! int c;
! 185: ! {
! 186: ! if ( !(c & 0x80 )) return 0;
! 187: ! if ( c == 0x8e ) return 0;
! 188: ! return 1;
! 189: ! }
! 190: !
! 191: ! is201kana(c) /* japanses extention */
! 192: ! int c;
! 193: ! {
! 194: ! if ( c == 0x8e ) return 1;
! 195: ! else return 0;
! 196: ! }
! 197: ! #else /* SJIS */
! 198: ! #define JIS_NUM_0 0x824f
! 199: ! #define JIS_NUM_9 (JIS_NUM_0 + '9'- '0')
! 200: ! #define JIS_ALPH_A 0x8260
! 201: ! #define JIS_ALPH_Z (JIS_ALPH_A + 'Z'-'A')
! 202: ! #define JIS_ALPH_a 0x8281
! 203: ! #define JIS_HIRA_SMALL_A 0x829f
! 204: ! #define JIS_HIRA_NN 0x82f1
! 205: ! #define JIS_KATA_SMALL_A 0x8340
! 206: ! #define JIS_KATA_SMALL_KE 0x8396
! 207: ! #define JIS_HIRA_U 0x82a4
! 208: ! #define JIS_KATA_U 0x83a5
! 209: ! #define JIS_KATA_VU 0x8394
! 210: !
! 211: ! #define JIS_KATA_UPPER 0x83
! 212: ! #define JIS_HIRA_UPPER 0x82
! 213: !
! 214: ! #define JIS_HIRA_A 0x82a0
! 215: ! #define JIS_KATA_A 0x8341
! 216: !
! 217: ! #define JIS_DAKUTEN 0x814a
! 218: ! #define JIS_HANDAKUTEN 0x814b
! 219: ! #define JIS_CHOUON 0x815b
! 220: !
! 221: ! int kana[] = {
! 222: ! /* . [ ] , . wo a */
! 223: ! 0x813f, 0x8142, 0x8175, 0x8176, 0x8141, 0x8145, 0x8392, 0x8340,
! 224: ! /* i u e o ya yu yo tsu */
! 225: ! 0x8342, 0x8344, 0x8346, 0x8348, 0x8383, 0x8385, 0x8387, 0x8362,
! 226: ! /* - a i u e o ka ki */
! 227: ! 0x815b, 0x8341, 0x8343, 0x8345, 0x8347, 0x8349, 0x834a, 0x834c,
! 228: ! /* ku ke ko sa si su se so */
! 229: ! 0x834e, 0x8350, 0x8352, 0x8354, 0x8356, 0x8358, 0x835a, 0x835c,
! 230: ! /* ta ti tu te to na ni nu */
! 231: ! 0x835e, 0x8360, 0x8363, 0x8365, 0x8367, 0x8369, 0x836a, 0x836b,
! 232: ! /* ne no ha hi hu he ho ma */
! 233: ! 0x836c, 0x836d, 0x836e, 0x8371, 0x8374, 0x8377, 0x837a, 0x837d,
! 234: ! /* mi mu me mo ya yu yo ra */
! 235: ! 0x837e, 0x8380, 0x8381, 0x8382, 0x8384, 0x8386, 0x8388, 0x8389,
! 236: ! /* ri ru re ro wa nn "" maru */
! 237: ! 0x838a, 0x838b, 0x838c, 0x838d, 0x838f, 0x8393, JIS_DAKUTEN,JIS_HANDAKUTEN
! 238: ! };
! 239: !
! 240: ! int daku[] = {0x834b, 0x834d, 0x834f, 0x8351, 0x8353, /* $B%,(J*/
! 241: ! 0x8355, 0x8357, 0x8359, 0x835b, 0x835d, /* $B%6(J */
! 242: ! 0x835f, 0x8361, 0x8364, 0x8366, 0x8367, /* $B%@(J */
! 243: ! 0x836f, 0x8372, 0x8375, 0x8378, 0x837b}; /* $B%P(J */
! 244: ! int handaku[] = {0x8370, 0x8373, 0x8376, 0x8379, 0x837c}; /* $B%Q(J */
! 245: ! int dakuall[] = {0x82aa, 0xa2ac, 0x82a3, 0x82b0, 0x82b2, /* $B$,(J */
! 246: ! 0x82b4, 0x82b6, 0x82b8, 0x82ba, 0x82bc, /* $B$6(J */
! 247: ! 0x82be, 0x82c0, 0x82c3, 0x82c5, 0x82c7, /* $B$@(J */
! 248: ! 0x82ce, 0x82d1, 0x82d4, 0x82d7, 0x82da, /* $B$P(J */
! 249: !
! 250: ! 0x834b, 0x834d, 0x834f, 0x8351, 0x8353, /* $B%,(J*/
! 251: ! 0x8355, 0x8357, 0x8359, 0x835b, 0x835d, /* $B%6(J */
! 252: ! 0x835f, 0x8361, 0x8364, 0x8366, 0x8367, /* $B%@(J */
! 253: ! 0x836f, 0x8372, 0x8375, 0x8378, 0x837b}; /* $B%P(J */
! 254: ! int handakuall[] = {0x82cf, 0x82d2, 0x82d5, 0x82d8, 0x82db, /* $B$Q(J */
! 255: ! 0x8370, 0x8373, 0x8376, 0x8379, 0x837c}; /* $B%Q(J */
! 256: !
! 257: ! iskanji(c) /* japanses extention */
! 258: ! int c;
! 259: ! {
! 260: ! c &= 0xff;
! 261: ! if (( c >= 0x81 && c <= 0x9f ) ||
! 262: ! ( c >= 0xe0 && c <= 0xea )) return 1;
! 263: ! return 0;
! 264: ! }
! 265: !
! 266: ! is201kana(c) /* japanses extention */
! 267: ! int c;
! 268: ! {
! 269: ! if ( c >= 0xa0 && c <= 0xdf ) return 1;
! 270: ! else return 0;
! 271: ! }
! 272: ! #endif
! 273: !
! 274: !
! 275: ! kana_char_order() /* japanese */
! 276: ! {
! 277: ! unsigned int c,i,j,cc;
! 278: !
! 279: ! for ( c = 0x8000 ; c < 0x10000 ; c++ )
! 280: ! char_order[c] = c;
! 281: !
! 282: ! /* NUMERIC */
! 283: ! for ( c = JIS_NUM_0 , i = '0' + 512; c <= JIS_NUM_9 ; i++,c++)
! 284: ! char_order[c] = i;
! 285: !
! 286: ! /* ALPHABET */
! 287: ! for ( c = JIS_ALPH_A , i = 'a' + 512; c <= JIS_ALPH_Z ; i++,c++) {
! 288: ! char_order[c] = i;
! 289: ! char_order[c+JIS_ALPH_a - JIS_ALPH_A] = i;
! 290: ! }
! 291: !
! 292: ! /* KANA */
! 293: ! for ( c = JIS_HIRA_SMALL_A ; c <= JIS_HIRA_NN ; c++ ) {
! 294: ! char_order[c] = c+512;
! 295: ! cc = c+JIS_KATA_SMALL_A-JIS_HIRA_SMALL_A;
! 296: ! #ifdef SJIS
! 297: ! if ( cc > 0x837e ) cc ++;
! 298: ! #endif
! 299: ! char_order[cc] = c+512;
! 300: ! if (isdaku(c) ) {
! 301: ! char_order[c] = c+512-1;
! 302: ! char_order[cc] = c+512-1;
! 303: ! } else if (ishandaku(c) ) {
! 304: ! char_order[c] = c+512-2;
! 305: ! char_order[cc] = c+512-2;
! 306: ! }
! 307: ! }
! 308: ! for ( c = JIS_KATA_VU ; c <= JIS_KATA_SMALL_KE ; c++ ) {
! 309: ! char_order[c] = c+512;
! 310: ! if (c == JIS_KATA_VU ) {
! 311: ! char_order[c] = JIS_KATA_U + 512;
! 312: ! }
! 313: ! }
! 314: ! }
! 315: !
! 316: !
! 317: ! #ifdef EUC
! 318: ! #define KANA_BYTES 2
! 319: ! #else
! 320: ! #define KANA_BYTES 2
! 321: ! #endif
! 322:
! 323: + static convert_htoz(str,ret)
! 324: + unsigned char *str;
! 325: + int *ret;
! 326: + {
! 327: + int c,c2;
! 328: +
! 329: + int num = KANA_BYTES;
! 330: +
! 331: + #ifdef EUC
! 332: + str++;
! 333: + #endif
! 334: + c = *str++;
! 335: + if (!is201kana(*str)) {
! 336: + if (c >= 0xa0 && c <= 0xdf)
! 337: + *ret = kana[c - 0xa0];
! 338: + else *ret = 0x8e00 + c;
! 339: + return num;
! 340: + }
! 341: + #ifdef EUC
! 342: + str++;
! 343: + #endif
! 344: + num += KANA_BYTES;
! 345: +
! 346: + if ( (c2 = *str++) == 0xde) { /* $BByE@(J */
! 347: + if (c >= 0xb6 && c <= 0xba) /* line-ga */
! 348: + c = daku[c - 0xb6];
! 349: + else if (c >= 0xbb && c <= 0xbf) /* line-za */
! 350: + c = daku[c - 0xbb+5];
! 351: + else if (c >= 0xc0 && c <= 0xc4) /* line-da */
! 352: + c = daku[c - 0xc0+10];
! 353: + else if (c >= 0xca && c <= 0xce) /* line-ba */
! 354: + c = daku[c - 0xca+15];
! 355: + else if ( c == 0xb3 ) /* vu */
! 356: + c = JIS_KATA_VU;
! 357: + } else if (c2 == 0xdf) { /* $BH>ByE@(J */
! 358: + if (c >= 0xca && c <= 0xce) /* line-pa */
! 359: + c = handaku[c - 0xca];
! 360: + } else if ( c2 == 0xb1 ) { /* $BD92;(J */
! 361: + if (c >= 0xa0 && c <= 0xdd)
! 362: + *ret = kana[c - 0xa0];
! 363: + else *ret = 0x8e00 + c;
! 364: + }
! 365: + if ( c < 0x100 ) c += 0x8e00;
! 366: +
! 367: + return num;
! 368: + }
! 369: +
! 370: + isadddaku(c)
! 371: + {
! 372: + int i;
! 373: + for ( i = 0 ; i < sizeof(dakuall) / sizeof(dakuall[1]) ; i++ )
! 374: + if ( dakuall[i]-1 == c ) return 1;
! 375: + return 0;
! 376: + }
! 377: +
! 378: + isaddhandaku(c)
! 379: + {
! 380: + int i;
! 381: + for ( i = 0 ; i < sizeof(handakuall) / sizeof(handakuall[1]) ; i++ )
! 382: + if ( handakuall[i]-2 == c ) return 1;
! 383: + return 0;
! 384: + }
! 385: +
! 386: + isdaku(c)
! 387: + {
! 388: + int i;
! 389: + for ( i = 0 ; i < sizeof(dakuall) / sizeof(dakuall[1]) ; i++ )
! 390: + if ( dakuall[i] == c ) return 1;
! 391: + return 0;
! 392: + }
! 393: +
! 394: + ishandaku(c)
! 395: + {
! 396: + int i;
! 397: + for ( i = 0 ; i < sizeof(handakuall) / sizeof(handakuall[1]) ; i++ )
! 398: + if ( handakuall[i] == c ) return 1;
! 399: + return 0;
! 400: + }
! 401: +
! 402: + int mbchar(str,ret)
! 403: + unsigned char *str;
! 404: + int *ret;
! 405: + {
! 406: + int c = *str++;
! 407: + int cc,ccc;
! 408: + if ( !iskanji(c) && !is201kana(c)) {
! 409: + *ret = c & 0xff;
! 410: + return 1;
! 411: + }
! 412: + if ( iskanji (c) ) {
! 413: + cc = ((c & 0xff) << 8) | ((*str++) & 0xff);
! 414: + ccc = (((*str++ ) & 0xff) << 8 ) | ((*str++) & 0xff);
! 415: +
! 416: + if ( ccc == JIS_DAKUTEN ) {
! 417: + if ( isadddaku(cc)) cc++;
! 418: + else if ( cc == JIS_KATA_U || cc == JIS_HIRA_U )
! 419: + cc = JIS_KATA_VU;
! 420: + *ret = cc;
! 421: + return 4;
! 422: + } else if ( ccc == JIS_HANDAKUTEN ) {
! 423: + if ( isaddhandaku(cc)) cc+=2;
! 424: + *ret = cc;
! 425: + return 4;
! 426: + } else if ( ccc == JIS_CHOUON ) {
! 427: + *ret = cc;
! 428: + return 4;
! 429: + } else {
! 430: + *ret = cc;
! 431: + return 2;
! 432: + }
! 433: + } else if ( is201kana(c)) {
! 434: + /* EUC */
! 435: + return convert_htoz(str-1,ret);
! 436: + }
! 437: + }
! 438: +
! 439: + xinitial(str,c)
! 440: + unsigned char *str;
! 441: + int c;
! 442: + {
! 443: + int up;
! 444: + if (isdaku(c)) c--;
! 445: + else if (ishandaku(c)) c-=2;
! 446: + else if ( c == JIS_KATA_VU ) c = JIS_KATA_U;
! 447: +
! 448: + if ((up= (c & 0xff00) >>8) == JIS_KATA_UPPER ) { /* katakana */
! 449: + c += JIS_HIRA_SMALL_A - JIS_KATA_SMALL_A;
! 450: + #ifdef SJIS
! 451: + if ( c > 0x837e ) c ++;
! 452: + #endif
! 453: + }
! 454: + *str++ = (c >> 8 ) & 0xfff;
! 455: + *str++ = c & 0xff;
! 456: + *str= 0;
! 457: + }
! 458: +
! 459: + make_initial(src,dst)
! 460: + unsigned char *src,*dst;
! 461: + {
! 462: + int len;
! 463: + int c;
! 464: +
! 465: + len = mbchar(src,&c);
! 466: + if ( len == 1 ) {
! 467: + dst[0] =c;
! 468: + dst[1] = 0;
! 469: + } else {
! 470: + xinitial(dst,c);
! 471: + len = 2;
! 472: + }
! 473: + return len;
! 474: + }
! 475: + #endif
! 476: +
! 477: void
! 478: init_char_order ()
! 479: {
! 480: ***************
! 481: *** 695,700 ****
! 482: --- 1081,1089 ----
! 483: char_order[i] = 512 + i;
! 484: char_order[i + 'A' - 'a'] = 512 + i;
! 485: }
! 486: + #ifdef KANJI
! 487: + kana_char_order(); /* japanese */
! 488: + #endif
! 489: }
! 490:
! 491: /* Compare two fields (each specified as a start pointer and a character count)
! 492: ***************
! 493: *** 741,751 ****
! 494: if (p1 == e1)
! 495: c1 = 0;
! 496: else
! 497: c1 = *p1++;
! 498: if (p2 == e2)
! 499: c2 = 0;
! 500: else
! 501: ! c2 = *p2++;
! 502:
! 503: if (char_order[c1] != char_order[c2])
! 504: return char_order[c1] - char_order[c2];
! 505: --- 1130,1149 ----
! 506: if (p1 == e1)
! 507: c1 = 0;
! 508: else
! 509: + #ifdef KANJI
! 510: + p1 += mbchar(p1,&c1); /* japanese */
! 511: + #else
! 512: c1 = *p1++;
! 513: + #endif
! 514: +
! 515: if (p2 == e2)
! 516: c2 = 0;
! 517: else
! 518: ! #ifdef KANJI
! 519: ! p2 += mbchar(p2,&c2); /* japanese */
! 520: ! #else
! 521: ! c2 = *p2++;
! 522: ! #endif
! 523:
! 524: if (char_order[c1] != char_order[c2])
! 525: return char_order[c1] - char_order[c2];
! 526: ***************
! 527: *** 763,777 ****
! 528: if (p1 == e1)
! 529: c1 = 0;
! 530: else
! 531: c1 = *p1++;
! 532: if (p2 == e2)
! 533: c2 = 0;
! 534: else
! 535: ! c2 = *p2++;
! 536: !
! 537: ! if (c1 != c2)
! 538: ! /* Reverse sign here so upper case comes out last. */
! 539: ! return c2 - c1;
! 540: if (!c1)
! 541: break;
! 542: }
! 543: --- 1161,1194 ----
! 544: if (p1 == e1)
! 545: c1 = 0;
! 546: else
! 547: + #ifdef KANJI
! 548: + p1 += mbchar(p1,&c1); /* japanese */
! 549: + #else
! 550: c1 = *p1++;
! 551: + #endif
! 552: if (p2 == e2)
! 553: c2 = 0;
! 554: else
! 555: ! #ifdef KANJI
! 556: ! p2 += mbchar(p2,&c2); /* japanese */
! 557: ! #else
! 558: ! c2 = *p2++;
! 559: ! #endif
! 560: ! #ifdef KANJI
! 561: ! if ( iskanji(c1) || is201kana(c1)) {
! 562: ! if (c1 != c2)
! 563: ! /* Reverse sign here so upper case comes out last. */
! 564: ! return c2 - c1;
! 565: ! } else {
! 566: ! if (c1 != c2)
! 567: ! return c1 - c2;
! 568: ! }
! 569: ! #else
! 570: !
! 571: ! if (c1 != c2)
! 572: ! /* Reverse sign here so upper case comes out last. */
! 573: ! return c2 - c1;
! 574: ! #endif
! 575: if (!c1)
! 576: break;
! 577: }
! 578: ***************
! 579: *** 1135,1141 ****
! 580: /* When we need a string of length 1 for the value of lastinitial,
! 581: store it here. */
! 582:
! 583: ! char lastinitial1[2];
! 584:
! 585: /* Initialize static storage for writing an index. */
! 586:
! 587: --- 1552,1558 ----
! 588: /* When we need a string of length 1 for the value of lastinitial,
! 589: store it here. */
! 590:
! 591: ! char lastinitial1[3]; /* japanese */
! 592:
! 593: /* Initialize static storage for writing an index. */
! 594:
! 595: ***************
! 596: *** 1168,1174 ****
! 597: int nosecondary;
! 598: int initiallength;
! 599: char *initial;
! 600: ! char initial1[2];
! 601: register char *p;
! 602:
! 603: /* First, analyze the parts of the entry fed to us this time. */
! 604: --- 1585,1591 ----
! 605: int nosecondary;
! 606: int initiallength;
! 607: char *initial;
! 608: ! char initial1[3]; /* japanese */
! 609: register char *p;
! 610:
! 611: /* First, analyze the parts of the entry fed to us this time. */
! 612: ***************
! 613: *** 1184,1193 ****
! 614: else
! 615: {
! 616: initial = initial1;
! 617: initial1[0] = *p;
! 618: initial1[1] = 0;
! 619: initiallength = 1;
! 620: !
! 621: if (initial1[0] >= 'a' && initial1[0] <= 'z')
! 622: initial1[0] -= 040;
! 623: }
! 624: --- 1601,1615 ----
! 625: else
! 626: {
! 627: initial = initial1;
! 628: + #ifdef KANJI
! 629: + initiallength = make_initial(p,initial1); /* japanese */
! 630: + #else
! 631: + initial = initial1;
! 632: initial1[0] = *p;
! 633: initial1[1] = 0;
! 634: initiallength = 1;
! 635: ! #endif
! 636: !
! 637: if (initial1[0] >= 'a' && initial1[0] <= 'z')
! 638: initial1[0] -= 040;
! 639: }
! 640: ***************
! 641: *** 1227,1232 ****
! 642: --- 1649,1656 ----
! 643: {
! 644: lastinitial = lastinitial1;
! 645: *lastinitial1 = *initial1;
! 646: + lastinitial1[1] = initial1[1];
! 647: + lastinitial1[2] = initial1[2];
! 648: }
! 649: else
! 650: {
! 651: --------------------------------(cur me)-----------------------------
! 652: --
! 653: ___ $B$o$7$O!";3?a?'$N$+$9$F!<$i$,Bg9%$-$G$N$%(J
! 654: [[o o]] $B$U$)$C$U$)$C$U$)(J
! 655: 'J' $B?92<(J $B$*Be41MM(J $B#M#a#N#M#O#S(J $B1QIW!w#k#n#o#w#l#e#d#g#e(J
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>