diff src/text.h @ 5092:3aa3888729c3

move inclusion point of text.h to clean things up a bit -------------------- ChangeLog entries follow: -------------------- src/ChangeLog addition: 2010-03-02 Ben Wing <ben@xemacs.org> * lisp.h: * text.h: Move inclusion point of text.h earlier in lisp.h -- just before the definition of characters, which needs some of the stuff in text.h. With text.h later, some basic character properties had to be defined in lisp.h -- put them back into text.h where they belong. Move some text in lisp.h at the point of text.h inclusion into text.h -- it serves as a mini-introduction.
author Ben Wing <ben@xemacs.org>
date Tue, 02 Mar 2010 06:19:51 -0600
parents 22179cd0fe15
children 6c6d78781d59
line wrap: on
line diff
--- a/src/text.h	Tue Mar 02 05:22:10 2010 -0600
+++ b/src/text.h	Tue Mar 02 06:19:51 2010 -0600
@@ -47,6 +47,33 @@
 
 BEGIN_C_DECLS
 
+/************************************************************************/
+/*        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 +193,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