/* [<][>][^][v][top][bottom][index][help] */
1 /*
2 * char-none.h
3 *
4 * Copyright (c) 2000-2003 Shiro Kawai, All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 *
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 *
17 * 3. Neither the name of the authors nor the names of its contributors
18 * may be used to endorse or promote products derived from this
19 * software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
27 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
28 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 *
33 * $Id: char_none.h,v 1.7 2003/07/10 13:12:28 shirok Exp $
34 */
35
36 #ifndef SCM_CHAR_ENCODING_BODY
37 /*===============================================================
38 * Header part
39 */
40
41 /* The name of the encoding. Scheme procedure
42 * gauche-character-encoding returns a symbol with this name.
43 */
44 #define SCM_CHAR_ENCODING_NAME "none"
45
46 /* Given first byte of the multibyte character, returns # of
47 * bytes that follows, i.e. if the byte consists a single-byte
48 * character, it returns 0; if the byte is the first byte of
49 * two-byte character, it returns 1. It may return -1 if
50 * the given byte can't be a valid first byte of multibyte characters.
51 */
52 #define SCM_CHAR_NFOLLOWS(ch) 0
53
54 /* Given wide character CH, returns # of bytes used when CH is
55 * encoded in multibyte string.
56 */
57 #define SCM_CHAR_NBYTES(ch) 1
58
59 /* Maximun # of multibyte character */
60 #define SCM_CHAR_MAX_BYTES 1
61
62 #define SCM_CHAR_GET(cp, ch) ((ch) = *(const unsigned char*)(cp))
63 #define SCM_CHAR_PUT(cp, ch) (*(cp) = (ch))
64
65 #define SCM_CHAR_BACKWARD(cp, start, result) \
66 do { \
67 if ((cp) > (start)) (result) = (cp)-1; \
68 else (result) = NULL; \
69 } while (0)
70
71 #else /* !SCM_CHAR_ENCODING_BODY */
72 /*==================================================================
73 * This part is included in char.c
74 */
75
76 /* Array of character encoding names, recognizable by iconv, that are
77 compatible with this native encoding. */
78 static const char *supportedCharacterEncodings[] = {
79 "NONE",
80 "ASCII",
81 "US-ASCII",
82 "ISO-8859-1",
83 "ISO_8859-1",
84 "ISO_8859-1:1987",
85 "ISO-8859-2",
86 "ISO_8859-2",
87 "ISO_8859-2:1987",
88 "ISO-8859-3",
89 "ISO_8859-3",
90 "ISO_8859-3:1988",
91 "ISO-8859-4",
92 "ISO_8859-4",
93 "ISO_8859-4:1988",
94 "ISO-8859-5",
95 "ISO_8859-5",
96 "ISO_8859-5:1988",
97 "ISO-8859-6",
98 "ISO_8859-6",
99 "ISO_8859-7:1987",
100 "ISO-8859-7",
101 "ISO_8859-7",
102 "ISO_8859-7:1987",
103 "ISO-8859-8",
104 "ISO_8859-8",
105 "ISO_8859-8:1988",
106 "ISO-8859-9",
107 "ISO_8859-9",
108 "ISO_8859-9:1989",
109 "ISO-8859-10",
110 "ISO_8859-10",
111 "ISO_8859-10:1993",
112 "ISO-8859-14",
113 "ISO_8859-14",
114 "ISO_8859-14:1998",
115 NULL
116 };
117
118 #endif /* !SCM_CHAR_ENCODING_BODY */