Annotation of embedaddon/libiconv/lib/riscos1.h, revision 1.1
1.1 ! misho 1: /*
! 2: * Copyright (C) 1999-2002 Free Software Foundation, Inc.
! 3: * This file is part of the GNU LIBICONV Library.
! 4: *
! 5: * The GNU LIBICONV Library is free software; you can redistribute it
! 6: * and/or modify it under the terms of the GNU Library General Public
! 7: * License as published by the Free Software Foundation; either version 2
! 8: * of the License, or (at your option) any later version.
! 9: *
! 10: * The GNU LIBICONV Library is distributed in the hope that it will be
! 11: * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
! 12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
! 13: * Library General Public License for more details.
! 14: *
! 15: * You should have received a copy of the GNU Library General Public
! 16: * License along with the GNU LIBICONV Library; see the file COPYING.LIB.
! 17: * If not, write to the Free Software Foundation, Inc., 51 Franklin Street,
! 18: * Fifth Floor, Boston, MA 02110-1301, USA.
! 19: */
! 20:
! 21: /*
! 22: * RISCOS-LATIN1
! 23: */
! 24:
! 25: static const unsigned short riscos1_2uni[32] = {
! 26: /* 0x80 */
! 27: 0x221a, 0x0174, 0x0175, 0x0083, 0x2573, 0x0176, 0x0177, 0x0087,
! 28: 0x21e6, 0x21e8, 0x21e9, 0x21e7, 0x2026, 0x2122, 0x2030, 0x2022,
! 29: /* 0x90 */
! 30: 0x2018, 0x2019, 0x2039, 0x203a, 0x201c, 0x201d, 0x201e, 0x2013,
! 31: 0x2014, 0x2212, 0x0152, 0x0153, 0x2020, 0x2021, 0xfb01, 0xfb02,
! 32: };
! 33:
! 34: static int
! 35: riscos1_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n)
! 36: {
! 37: unsigned char c = *s;
! 38: if (c >= 0x80 && c < 0xa0)
! 39: *pwc = (ucs4_t) riscos1_2uni[c-0x80];
! 40: else
! 41: *pwc = (ucs4_t) c;
! 42: return 1;
! 43: }
! 44:
! 45: static const unsigned char riscos1_page01[40] = {
! 46: 0x00, 0x00, 0x9a, 0x9b, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */
! 47: 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */
! 48: 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */
! 49: 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */
! 50: 0x00, 0x00, 0x00, 0x00, 0x81, 0x82, 0x85, 0x86, /* 0x70-0x77 */
! 51: };
! 52: static const unsigned char riscos1_page20[48] = {
! 53: 0x00, 0x00, 0x00, 0x97, 0x98, 0x00, 0x00, 0x00, /* 0x10-0x17 */
! 54: 0x90, 0x91, 0x00, 0x00, 0x94, 0x95, 0x96, 0x00, /* 0x18-0x1f */
! 55: 0x9c, 0x9d, 0x8f, 0x00, 0x00, 0x00, 0x8c, 0x00, /* 0x20-0x27 */
! 56: 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */
! 57: 0x8e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */
! 58: 0x00, 0x92, 0x93, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */
! 59: };
! 60: static const unsigned char riscos1_page21[16] = {
! 61: 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x8b, /* 0xe0-0xe7 */
! 62: 0x89, 0x8a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */
! 63: };
! 64: static const unsigned char riscos1_page22[16] = {
! 65: 0x00, 0x00, 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
! 66: 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */
! 67: };
! 68:
! 69: static int
! 70: riscos1_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n)
! 71: {
! 72: unsigned char c = 0;
! 73: if (wc < 0x0080 || wc == 0x0083 || wc == 0x0087 || (wc >= 0x00a0 && wc < 0x0100)) {
! 74: *r = wc;
! 75: return 1;
! 76: }
! 77: else if (wc >= 0x0150 && wc < 0x0178)
! 78: c = riscos1_page01[wc-0x0150];
! 79: else if (wc >= 0x2010 && wc < 0x2040)
! 80: c = riscos1_page20[wc-0x2010];
! 81: else if (wc == 0x2122)
! 82: c = 0x8d;
! 83: else if (wc >= 0x21e0 && wc < 0x21f0)
! 84: c = riscos1_page21[wc-0x21e0];
! 85: else if (wc >= 0x2210 && wc < 0x2220)
! 86: c = riscos1_page22[wc-0x2210];
! 87: else if (wc == 0x2573)
! 88: c = 0x84;
! 89: else if (wc >= 0xfb01 && wc < 0xfb03)
! 90: c = wc-0xfa63;
! 91: if (c != 0) {
! 92: *r = c;
! 93: return 1;
! 94: }
! 95: return RET_ILUNI;
! 96: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>