49 big5_0_mbtowc (conv_t conv, ucs4_t *pwc, 
const unsigned char *s, 
int n)
 
   51   unsigned char c1 = s[0];
 
   52   if (c1 >= 0x21 && c1 <= 0x62) {
 
   54       unsigned char c2 = s[1];
 
   55       if (c2 >= 0x21 && c2 <= 0x7e) {
 
   56         unsigned int i = 94 * (c1 - 0x21) + (c2 - 0x21);
 
   60           buf[0] = (i / 157) + 0xa1;
 
   62           buf[1] = i + (i < 0x3f ? 0x40 : 0x62);
 
   63           return big5_mbtowc(conv,pwc,buf,2);
 
   67             unsigned short wc = big5_2uni_pagea1[i];
 
   83 big5_1_mbtowc (conv_t conv, ucs4_t *pwc, 
const unsigned char *s, 
int n)
 
   85   unsigned char c1 = s[0];
 
   86   if (c1 >= 0x21 && c1 <= 0x72) {
 
   88       unsigned char c2 = s[1];
 
   89       if (c2 >= 0x21 && c2 <= 0x7e) {
 
   90         unsigned int i = 94 * (c1 - 0x21) + (c2 - 0x21);
 
   94           buf[0] = (i / 157) + 0xc9;
 
   96           buf[1] = i + (i < 0x3f ? 0x40 : 0x62);
 
   97           return big5_mbtowc(conv,pwc,buf,2);
 
  101             unsigned short wc = big5_2uni_pagec9[i];
 
  111     return RET_TOOFEW(0);
 
  117 big5_0_wctomb (conv_t conv, 
unsigned char *r, ucs4_t wc, 
int n)
 
  120     unsigned char buf[2];
 
  121     int ret = big5_wctomb(conv,buf,wc,2);
 
  122     if (ret != RET_ILSEQ) {
 
  123       unsigned char s1, s2;
 
  124       if (ret != 2) abort();
 
  127       if (!(s1 >= 0xa1)) abort();
 
  128       if (!((s2 >= 0x40 && s2 <= 0x7e) || (s2 >= 0xa1 && s2 <= 0xfe))) abort();
 
  130         unsigned int t = 157 * (s1 - 0xa1) + s2 - (s2 < 0x80 ? 0x40 : 0x62);
 
  131         r[0] = (t / 94) + 0x21;
 
  132         r[1] = (t % 94) + 0x21;
 
  142 big5_1_wctomb (conv_t conv, 
unsigned char *r, ucs4_t wc, 
int n)
 
  145     unsigned char buf[2];
 
  146     int ret = big5_wctomb(conv,buf,wc,2);
 
  147     if (ret != RET_ILSEQ) {
 
  148       unsigned char s1, s2;
 
  149       if (ret != 2) abort();
 
  152       if (!(s1 <= 0xf9)) abort();
 
  153       if (!((s2 >= 0x40 && s2 <= 0x7e) || (s2 >= 0xa1 && s2 <= 0xfe))) abort();
 
  155         unsigned int t = 157 * (s1 - 0xc9) + s2 - (s2 < 0x80 ? 0x40 : 0x62);
 
  156         r[0] = (t / 94) + 0x21;
 
  157         r[1] = (t % 94) + 0x21;