FLTK 1.3.2

- Main Page
- Related Pages
- Modules
- Classes
- Files

- File List
- File Members

ucs2be.h

    00001 /*
    00002  * UCS-2BE = UCS-2 big endian
    00003  */
    00004 /* $XFree86: xc/lib/X11/lcUniConv/ucs2be.h,v 1.1 2000/11/28 17:25:09 dawes Exp $ */
    00005
    00006 static int
    00007 ucs2be_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n)
    00008 {
    00009   if (n >= 2) {
    00010     if (s[0] >= 0xd8 && s[0] < 0xe0) {
    00011       return RET_ILSEQ;
    00012     } else {
    00013       *pwc = (s[0] << 8) + s[1];
    00014       return 2;
    00015     }
    00016   }
    00017   return RET_TOOFEW(0);
    00018 }
    00019
    00020 static int
    00021 ucs2be_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n)
    00022 {
    00023   if (wc < 0x10000 && !(wc >= 0xd800 && wc < 0xe000)) {
    00024     if (n >= 2) {
    00025       r[0] = (unsigned char) (wc >> 8);
    00026       r[1] = (unsigned char) wc;
    00027       return 2;
    00028     } else
    00029       return RET_TOOSMALL;
    00030   }
    00031   return RET_ILSEQ;
    00032 }