Mercurial > hg > xemacs-beta
diff 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 |
line wrap: on
line diff
--- a/src/text.h Sat Feb 20 06:03:00 2010 -0600 +++ b/src/text.h Sun May 01 18:44:03 2011 +0100 @@ -5,10 +5,10 @@ This file is part of XEmacs. -XEmacs is free software; you can redistribute it and/or modify it +XEmacs is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) any -later version. +Free Software Foundation, either version 3 of the License, or (at your +option) any later version. XEmacs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or @@ -16,9 +16,7 @@ for more details. You should have received a copy of the GNU General Public License -along with XEmacs; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ +along with XEmacs. If not, see <http://www.gnu.org/licenses/>. */ /* Synched up with: FSF 19.30. */ @@ -47,6 +45,62 @@ BEGIN_C_DECLS +/* Forward compatibility from ben-unicode-internal: Following used for + functions that do character conversion and need to handle errors. */ + +enum converr + { + /* ---- Basic actions ---- */ + + /* Do nothing upon failure and return a failure indication. + Same as what happens when the *_raw() version is called. */ + CONVERR_FAIL, + /* abort() on failure, i.e. crash. */ + CONVERR_ABORT, + /* Signal a Lisp error. */ + CONVERR_ERROR, + /* Try to "recover" and continue processing. Currently this is always + the same as CONVERR_SUBSTITUTE, where one of the substitution + characters defined below (CANT_CONVERT_*) is used. */ + CONVERR_SUCCEED, + + /* ---- More specific actions ---- */ + + /* Substitute something (0xFFFD, the Unicode replacement character, + when converting to Unicode or to a Unicode-internal Ichar, JISX0208 + GETA mark when converting to non-Mule Ichar). */ + CONVERR_SUBSTITUTE, + /* Use private Unicode space when converting to Unicode. */ + CONVERR_USE_PRIVATE + }; + +/************************************************************************/ +/* A short intro to the format of text and of characters */ +/************************************************************************/ + +/* + "internally formatted text" and the term "internal format" in + general are likely to refer to the format of text in buffers and + strings; "externally formatted text" and the term "external format" + refer to any text format used in the O.S. or elsewhere outside of + XEmacs. The format of text and of a character are related and + there must be a one-to-one relationship (hopefully through a + relatively simple algorithmic means of conversion) between a string + of text and an equivalent array of characters, but the conversion + between the two is NOT necessarily trivial. + + In a non-Mule XEmacs, allowed characters are numbered 0 through + 255, where no fixed meaning is assigned to them, but (when + representing text, rather than bytes in a binary file) in practice + the lower half represents ASCII and the upper half some other 8-bit + character set (chosen by setting the font, case tables, syntax + tables, etc. appropriately for the character set through ad-hoc + means such as the `iso-8859-1' file and the + `standard-display-european' function). + + For more info, see `text.c' and the Internals Manual. +*/ + /* ---------------------------------------------------------------------- */ /* Super-basic character properties */ /* ---------------------------------------------------------------------- */ @@ -166,6 +220,29 @@ #endif /* not MULE */ +#ifdef MULE + +MODULE_API int non_ascii_valid_ichar_p (Ichar ch); + +/* Return whether the given Ichar is valid. + */ + +DECLARE_INLINE_HEADER ( +int +valid_ichar_p (Ichar ch) +) +{ + return (! (ch & ~0xFF)) || non_ascii_valid_ichar_p (ch); +} + +#else /* not MULE */ + +/* This works when CH is negative, and correctly returns non-zero only when CH + is in the range [0, 255], inclusive. */ +#define valid_ichar_p(ch) (! (ch & ~0xFF)) + +#endif /* not MULE */ + /* For more discussion, see text.c, "handling non-default formats" */ typedef enum internal_format @@ -2010,9 +2087,15 @@ if ((ei)->mallocp_) \ { \ if ((ei)->data_) \ - xfree ((ei)->data_); \ + { \ + xfree ((ei)->data_); \ + (ei)->data_ = 0; \ + } \ if ((ei)->extdata_) \ - xfree ((ei)->extdata_); \ + { \ + xfree ((ei)->extdata_); \ + (ei)->extdata_ = 0; \ + } \ eiinit_malloc (ei); \ } \ else \ @@ -3010,7 +3093,7 @@ #endif #define Qunix_host_name_encoding Qnative #define Qunix_service_name_encoding Qnative -#define Qtime_function_encoding Qnative +#define Qtime_function_encoding Qbinary #define Qtime_zone_encoding Qtime_function_encoding #define Qmswindows_host_name_encoding Qmswindows_multibyte #define Qmswindows_service_name_encoding Qmswindows_multibyte