2 * fribidi-char-sets-iso8859-8.c - ISO8859-8 character set conversion routines
4 * $Id: fribidi-char-sets-iso8859-8.c,v 1.2 2004-05-03 22:05:19 behdad Exp $
6 * $Date: 2004-05-03 22:05:19 $
8 * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/charset/fribidi-char-sets-iso8859-8.c,v $
11 * Behdad Esfahbod, 2001, 2002, 2004
12 * Dov Grobgeld, 1999, 2000
14 * Copyright (C) 2004 Sharif FarsiWeb, Inc
15 * Copyright (C) 2001,2002 Behdad Esfahbod
16 * Copyright (C) 1999,2000 Dov Grobgeld
18 * This library is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU Lesser General Public
20 * License as published by the Free Software Foundation; either
21 * version 2.1 of the License, or (at your option) any later version.
23 * This library is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
26 * Lesser General Public License for more details.
28 * You should have received a copy of the GNU Lesser General Public License
29 * along with this library, in a file named COPYING; if not, write to the
30 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
31 * Boston, MA 02110-1301, USA
33 * For licensing issues, contact <license@farsiweb.info>.
38 #include <fribidi-char-sets-iso8859-8.h>
40 #include <fribidi-unicode.h>
42 /* The following are proposed extensions to ISO8859-8. */
43 #define ISO_8859_8_LRM 0xFD
44 #define ISO_8859_8_RLM 0xFE
45 #define ISO_8859_8_LRE 0xFB
46 #define ISO_8859_8_RLE 0xFC
47 #define ISO_8859_8_PDF 0xDD
48 #define ISO_8859_8_LRO 0xDB
49 #define ISO_8859_8_RLO 0xDC
53 #define UNI_ALEF 0x05D0
54 #define UNI_TAV 0x05EA
57 fribidi_iso8859_8_to_unicode_c (
62 register unsigned char ch = (unsigned char) sch;
63 if (ch < ISO_8859_8_LRO)
65 else if (ch >= ISO_ALEF && ch <= ISO_TAV)
66 return ch - ISO_ALEF + UNI_ALEF;
70 return FRIBIDI_CHAR_RLM;
72 return FRIBIDI_CHAR_LRM;
74 return FRIBIDI_CHAR_RLO;
76 return FRIBIDI_CHAR_LRO;
78 return FRIBIDI_CHAR_RLE;
80 return FRIBIDI_CHAR_LRE;
82 return FRIBIDI_CHAR_PDF;
89 fribidi_unicode_to_iso8859_8_c (
96 if (uch >= UNI_ALEF && uch <= UNI_TAV)
97 return (char) (uch - UNI_ALEF + ISO_ALEF);
100 case FRIBIDI_CHAR_RLM:
101 return (char) ISO_8859_8_RLM;
102 case FRIBIDI_CHAR_LRM:
103 return (char) ISO_8859_8_LRM;
104 case FRIBIDI_CHAR_RLO:
105 return (char) ISO_8859_8_RLO;
106 case FRIBIDI_CHAR_LRO:
107 return (char) ISO_8859_8_LRO;
108 case FRIBIDI_CHAR_RLE:
109 return (char) ISO_8859_8_RLE;
110 case FRIBIDI_CHAR_LRE:
111 return (char) ISO_8859_8_LRE;
112 case FRIBIDI_CHAR_PDF:
113 return (char) ISO_8859_8_PDF;
118 /* Editor directions:
119 * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent