Partially sync files.el from XEmacs 21.5 for wildcard support.
[sxemacs] / src / iso-wide.h
1 /*
2 This file is part of SXEmacs
3
4 SXEmacs is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
8
9 SXEmacs is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program.  If not, see <http://www.gnu.org/licenses/>. */
16
17
18 /* Synched up with: Not in FSF. */
19
20 #ifndef INCLUDED_iso_wide_h_
21 #define INCLUDED_iso_wide_h_
22
23 /* The following macros are designed for SunOS 5.0 wide characters,
24    in which the single byte ISO Latin-1 character 1xxxxxxx are represented
25
26                 00110000 00000000 00000000 0xxxxxxx
27
28    For wide character systems which maintain the numeric value of all
29    single-byte characters, IN_TABLE_DOMAIN can simply be defined
30
31                 (0 <= (c) && (c) <= 0xff)
32
33    and no funky ISO_WIDE_TO_BYTE conversions are needed. */
34
35 /* Can't use isascii() because we want wide char argument */
36 #define IS_ASCII(c)     (0 <= (c) && (c) <= 0x7f)
37
38 #define IS_ISO_WIDE(c)  (0x30000000 <= (c) && (c) <= 0x3000007f)
39 #define IS_ISO_BYTE(c)  (0x80 <= (c) && (c) <= 0xff)
40
41 #define IN_TABLE_DOMAIN(c)  (IS_ASCII (c) || IS_ISO_WIDE (c))
42
43 #define ISO_WIDE_TO_BYTE(c)  ((c) & 0x0000007f | 0x80)
44 #define ISO_BYTE_TO_WIDE(c)  ((c) & 0x7f | 0x30000000)
45
46 #define WIDE_TO_BYTE(c)  (IS_ISO_WIDE (c) ? ISO_WIDE_TO_BYTE (c) : (c))
47 #define BYTE_TO_WIDE(c)  (IS_ISO_BYTE (c) ? ISO_BYTE_TO_WIDE (c) : (c))
48
49 #endif                          /* INCLUDED_iso_wide_h_ */