00001
00002
00003
00004
00005
00006
00007 #ifdef NEED_TOWC
00008 static const unsigned short iso8859_15_2uni[32] = {
00009
00010 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x20ac, 0x00a5, 0x0160, 0x00a7,
00011 0x0161, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af,
00012
00013 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x017d, 0x00b5, 0x00b6, 0x00b7,
00014 0x017e, 0x00b9, 0x00ba, 0x00bb, 0x0152, 0x0153, 0x0178, 0x00bf,
00015 };
00016
00017 static int
00018 iso8859_15_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n)
00019 {
00020 unsigned char c = *s;
00021 if (c >= 0xa0 && c < 0xc0)
00022 *pwc = (ucs4_t) iso8859_15_2uni[c-0xa0];
00023 else
00024 *pwc = (ucs4_t) c;
00025 return 1;
00026 }
00027 #endif
00028
00029 #ifdef NEED_TOMB
00030 static const unsigned char iso8859_15_page00[32] = {
00031 0xa0, 0xa1, 0xa2, 0xa3, 0x00, 0xa5, 0x00, 0xa7,
00032 0x00, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
00033 0xb0, 0xb1, 0xb2, 0xb3, 0x00, 0xb5, 0xb6, 0xb7,
00034 0x00, 0xb9, 0xba, 0xbb, 0x00, 0x00, 0x00, 0xbf,
00035 };
00036 static const unsigned char iso8859_15_page01[48] = {
00037 0x00, 0x00, 0xbc, 0xbd, 0x00, 0x00, 0x00, 0x00,
00038 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00039 0xa6, 0xa8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00040 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00041 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
00042 0xbe, 0x00, 0x00, 0x00, 0x00, 0xb4, 0xb8, 0x00,
00043 };
00044
00045 static int
00046 iso8859_15_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n)
00047 {
00048 unsigned char c = 0;
00049 if (wc < 0x00a0) {
00050 *r = wc;
00051 return 1;
00052 }
00053 else if (wc >= 0x00a0 && wc < 0x00c0)
00054 c = iso8859_15_page00[wc-0x00a0];
00055 else if (wc >= 0x00c0 && wc < 0x0100)
00056 c = wc;
00057 else if (wc >= 0x0150 && wc < 0x0180)
00058 c = iso8859_15_page01[wc-0x0150];
00059 else if (wc == 0x20ac)
00060 c = 0xa4;
00061 if (c != 0) {
00062 *r = c;
00063 return 1;
00064 }
00065 return RET_ILSEQ;
00066 }
00067 #endif