diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2017-07-21 12:31:09 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2017-08-25 10:06:49 +0200 |
commit | c350873c7c977efe5210484f04160be45f84ba7e (patch) | |
tree | 717d33eb315f4def1307d65108d14715696cd5cf /nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_15.h | |
parent | 1472e7e37838f17b7ed948fa206e8c3434a9d346 (diff) | |
download | nx-libs-c350873c7c977efe5210484f04160be45f84ba7e.tar.gz nx-libs-c350873c7c977efe5210484f04160be45f84ba7e.tar.bz2 nx-libs-c350873c7c977efe5210484f04160be45f84ba7e.zip |
Convert nx-X11/lib/ build flow from imake to autotools.
Diffstat (limited to 'nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_15.h')
-rw-r--r-- | nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_15.h | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_15.h b/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_15.h new file mode 100644 index 000000000..631d9b5e2 --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_15.h @@ -0,0 +1,62 @@ + +/* + * ISO-8859-15 + */ + +static const unsigned short iso8859_15_2uni[32] = { + /* 0xa0 */ + 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x20ac, 0x00a5, 0x0160, 0x00a7, + 0x0161, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, + /* 0xb0 */ + 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x017d, 0x00b5, 0x00b6, 0x00b7, + 0x017e, 0x00b9, 0x00ba, 0x00bb, 0x0152, 0x0153, 0x0178, 0x00bf, +}; + +static int +iso8859_15_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) +{ + unsigned char c = *s; + if (c >= 0xa0 && c < 0xc0) + *pwc = (ucs4_t) iso8859_15_2uni[c-0xa0]; + else + *pwc = (ucs4_t) c; + return 1; +} + +static const unsigned char iso8859_15_page00[32] = { + 0xa0, 0xa1, 0xa2, 0xa3, 0x00, 0xa5, 0x00, 0xa7, /* 0xa0-0xa7 */ + 0x00, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ + 0xb0, 0xb1, 0xb2, 0xb3, 0x00, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ + 0x00, 0xb9, 0xba, 0xbb, 0x00, 0x00, 0x00, 0xbf, /* 0xb8-0xbf */ +}; +static const unsigned char iso8859_15_page01[48] = { + 0x00, 0x00, 0xbc, 0xbd, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ + 0xa6, 0xa8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ + 0xbe, 0x00, 0x00, 0x00, 0x00, 0xb4, 0xb8, 0x00, /* 0x78-0x7f */ +}; + +static int +iso8859_15_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) +{ + unsigned char c = 0; + if (wc < 0x00a0) { + *r = wc; + return 1; + } + else if (wc >= 0x00a0 && wc < 0x00c0) + c = iso8859_15_page00[wc-0x00a0]; + else if (wc >= 0x00c0 && wc < 0x0100) + c = wc; + else if (wc >= 0x0150 && wc < 0x0180) + c = iso8859_15_page01[wc-0x0150]; + else if (wc == 0x20ac) + c = 0xa4; + if (c != 0) { + *r = c; + return 1; + } + return RET_ILSEQ; +} |