Mercurial > hg > xemacs-beta
comparison src/text.h @ 5495:1f0b15040456
Merge.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Sun, 01 May 2011 18:44:03 +0100 |
parents | 308d34e9f07d |
children | 7a538e1a4676 |
comparison
equal
deleted
inserted
replaced
5494:861f2601a38b | 5495:1f0b15040456 |
---|---|
3 Copyright (C) 1995 Sun Microsystems, Inc. | 3 Copyright (C) 1995 Sun Microsystems, Inc. |
4 Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2010 Ben Wing. | 4 Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2010 Ben Wing. |
5 | 5 |
6 This file is part of XEmacs. | 6 This file is part of XEmacs. |
7 | 7 |
8 XEmacs is free software; you can redistribute it and/or modify it | 8 XEmacs is free software: you can redistribute it and/or modify it |
9 under the terms of the GNU General Public License as published by the | 9 under the terms of the GNU General Public License as published by the |
10 Free Software Foundation; either version 2, or (at your option) any | 10 Free Software Foundation, either version 3 of the License, or (at your |
11 later version. | 11 option) any later version. |
12 | 12 |
13 XEmacs is distributed in the hope that it will be useful, but WITHOUT | 13 XEmacs is distributed in the hope that it will be useful, but WITHOUT |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | 14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | 15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
16 for more details. | 16 for more details. |
17 | 17 |
18 You should have received a copy of the GNU General Public License | 18 You should have received a copy of the GNU General Public License |
19 along with XEmacs; see the file COPYING. If not, write to | 19 along with XEmacs. If not, see <http://www.gnu.org/licenses/>. */ |
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
21 Boston, MA 02111-1307, USA. */ | |
22 | 20 |
23 /* Synched up with: FSF 19.30. */ | 21 /* Synched up with: FSF 19.30. */ |
24 | 22 |
25 /* Authorship: | 23 /* Authorship: |
26 | 24 |
45 char *strupr (char *); | 43 char *strupr (char *); |
46 #endif | 44 #endif |
47 | 45 |
48 BEGIN_C_DECLS | 46 BEGIN_C_DECLS |
49 | 47 |
48 /* Forward compatibility from ben-unicode-internal: Following used for | |
49 functions that do character conversion and need to handle errors. */ | |
50 | |
51 enum converr | |
52 { | |
53 /* ---- Basic actions ---- */ | |
54 | |
55 /* Do nothing upon failure and return a failure indication. | |
56 Same as what happens when the *_raw() version is called. */ | |
57 CONVERR_FAIL, | |
58 /* abort() on failure, i.e. crash. */ | |
59 CONVERR_ABORT, | |
60 /* Signal a Lisp error. */ | |
61 CONVERR_ERROR, | |
62 /* Try to "recover" and continue processing. Currently this is always | |
63 the same as CONVERR_SUBSTITUTE, where one of the substitution | |
64 characters defined below (CANT_CONVERT_*) is used. */ | |
65 CONVERR_SUCCEED, | |
66 | |
67 /* ---- More specific actions ---- */ | |
68 | |
69 /* Substitute something (0xFFFD, the Unicode replacement character, | |
70 when converting to Unicode or to a Unicode-internal Ichar, JISX0208 | |
71 GETA mark when converting to non-Mule Ichar). */ | |
72 CONVERR_SUBSTITUTE, | |
73 /* Use private Unicode space when converting to Unicode. */ | |
74 CONVERR_USE_PRIVATE | |
75 }; | |
76 | |
77 /************************************************************************/ | |
78 /* A short intro to the format of text and of characters */ | |
79 /************************************************************************/ | |
80 | |
81 /* | |
82 "internally formatted text" and the term "internal format" in | |
83 general are likely to refer to the format of text in buffers and | |
84 strings; "externally formatted text" and the term "external format" | |
85 refer to any text format used in the O.S. or elsewhere outside of | |
86 XEmacs. The format of text and of a character are related and | |
87 there must be a one-to-one relationship (hopefully through a | |
88 relatively simple algorithmic means of conversion) between a string | |
89 of text and an equivalent array of characters, but the conversion | |
90 between the two is NOT necessarily trivial. | |
91 | |
92 In a non-Mule XEmacs, allowed characters are numbered 0 through | |
93 255, where no fixed meaning is assigned to them, but (when | |
94 representing text, rather than bytes in a binary file) in practice | |
95 the lower half represents ASCII and the upper half some other 8-bit | |
96 character set (chosen by setting the font, case tables, syntax | |
97 tables, etc. appropriately for the character set through ad-hoc | |
98 means such as the `iso-8859-1' file and the | |
99 `standard-display-european' function). | |
100 | |
101 For more info, see `text.c' and the Internals Manual. | |
102 */ | |
103 | |
50 /* ---------------------------------------------------------------------- */ | 104 /* ---------------------------------------------------------------------- */ |
51 /* Super-basic character properties */ | 105 /* Super-basic character properties */ |
52 /* ---------------------------------------------------------------------- */ | 106 /* ---------------------------------------------------------------------- */ |
53 | 107 |
54 /* These properties define the specifics of how our current encoding fits | 108 /* These properties define the specifics of how our current encoding fits |
161 /* Maximum number of bytes per Emacs character when represented as text, in | 215 /* Maximum number of bytes per Emacs character when represented as text, in |
162 any format. | 216 any format. |
163 */ | 217 */ |
164 | 218 |
165 #define MAX_ICHAR_LEN 4 | 219 #define MAX_ICHAR_LEN 4 |
220 | |
221 #endif /* not MULE */ | |
222 | |
223 #ifdef MULE | |
224 | |
225 MODULE_API int non_ascii_valid_ichar_p (Ichar ch); | |
226 | |
227 /* Return whether the given Ichar is valid. | |
228 */ | |
229 | |
230 DECLARE_INLINE_HEADER ( | |
231 int | |
232 valid_ichar_p (Ichar ch) | |
233 ) | |
234 { | |
235 return (! (ch & ~0xFF)) || non_ascii_valid_ichar_p (ch); | |
236 } | |
237 | |
238 #else /* not MULE */ | |
239 | |
240 /* This works when CH is negative, and correctly returns non-zero only when CH | |
241 is in the range [0, 255], inclusive. */ | |
242 #define valid_ichar_p(ch) (! (ch & ~0xFF)) | |
166 | 243 |
167 #endif /* not MULE */ | 244 #endif /* not MULE */ |
168 | 245 |
169 /* For more discussion, see text.c, "handling non-default formats" */ | 246 /* For more discussion, see text.c, "handling non-default formats" */ |
170 | 247 |
2008 #define eifree(ei) \ | 2085 #define eifree(ei) \ |
2009 do { \ | 2086 do { \ |
2010 if ((ei)->mallocp_) \ | 2087 if ((ei)->mallocp_) \ |
2011 { \ | 2088 { \ |
2012 if ((ei)->data_) \ | 2089 if ((ei)->data_) \ |
2013 xfree ((ei)->data_); \ | 2090 { \ |
2091 xfree ((ei)->data_); \ | |
2092 (ei)->data_ = 0; \ | |
2093 } \ | |
2014 if ((ei)->extdata_) \ | 2094 if ((ei)->extdata_) \ |
2015 xfree ((ei)->extdata_); \ | 2095 { \ |
2096 xfree ((ei)->extdata_); \ | |
2097 (ei)->extdata_ = 0; \ | |
2098 } \ | |
2016 eiinit_malloc (ei); \ | 2099 eiinit_malloc (ei); \ |
2017 } \ | 2100 } \ |
2018 else \ | 2101 else \ |
2019 eiinit (ei); \ | 2102 eiinit (ei); \ |
2020 } while (0) | 2103 } while (0) |
3008 #define Qcommand_argument_encoding Qnative | 3091 #define Qcommand_argument_encoding Qnative |
3009 #define Qenvironment_variable_encoding Qnative | 3092 #define Qenvironment_variable_encoding Qnative |
3010 #endif | 3093 #endif |
3011 #define Qunix_host_name_encoding Qnative | 3094 #define Qunix_host_name_encoding Qnative |
3012 #define Qunix_service_name_encoding Qnative | 3095 #define Qunix_service_name_encoding Qnative |
3013 #define Qtime_function_encoding Qnative | 3096 #define Qtime_function_encoding Qbinary |
3014 #define Qtime_zone_encoding Qtime_function_encoding | 3097 #define Qtime_zone_encoding Qtime_function_encoding |
3015 #define Qmswindows_host_name_encoding Qmswindows_multibyte | 3098 #define Qmswindows_host_name_encoding Qmswindows_multibyte |
3016 #define Qmswindows_service_name_encoding Qmswindows_multibyte | 3099 #define Qmswindows_service_name_encoding Qmswindows_multibyte |
3017 #define Quser_name_encoding Qnative | 3100 #define Quser_name_encoding Qnative |
3018 #define Qerror_message_encoding Qnative | 3101 #define Qerror_message_encoding Qnative |