+
+/* Flag bits in a character. These also get used in termhooks.h.
+ Richard Stallman <rms@gnu.ai.mit.edu> thinks that MULE
+ (MUlti-Lingual Emacs) might need 18 bits for the character value
+ itself, so we probably shouldn't use any bits lower than 0x040000. */
+#define CHAR_ALT (0x040000)
+#define CHAR_SUPER (0x080000)
+#define CHAR_HYPER (0x100000)
+#define CHAR_SHIFT (0x200000)
+#define CHAR_CTL (0x400000)
+#define CHAR_META (0x800000)
+
+#ifdef USE_X_TOOLKIT
+#ifdef NO_UNION_TYPE
+/* Use this for turning a (void *) into a Lisp_Object, as when the
+ Lisp_Object is passed into a toolkit callback function. */
+#define VOID_TO_LISP(larg,varg) \
+ do { ((larg) = ((Lisp_Object) (varg))); } while (0)
+#define CVOID_TO_LISP VOID_TO_LISP
+
+/* Use this for turning a Lisp_Object into a (void *), as when the
+ Lisp_Object is passed into a toolkit callback function. */
+#define LISP_TO_VOID(larg) ((void *) (larg))
+#define LISP_TO_CVOID(varg) ((const void *) (larg))
+
+#else /* not NO_UNION_TYPE */
+/* Use this for turning a (void *) into a Lisp_Object, as when the
+ Lisp_Object is passed into a toolkit callback function. */
+#define VOID_TO_LISP(larg,varg) \
+ do { ((larg).v = (void *) (varg)); } while (0)
+#define CVOID_TO_LISP(larg,varg) \
+ do { ((larg).cv = (const void *) (varg)); } while (0)
+
+/* Use this for turning a Lisp_Object into a (void *), as when the
+ Lisp_Object is passed into a toolkit callback function. */
+#define LISP_TO_VOID(larg) ((larg).v)
+#define LISP_TO_CVOID(larg) ((larg).cv)
+#endif /* not NO_UNION_TYPE */
+#endif /* USE_X_TOOLKIT */
+
+\f
+/* The glyph datatype, used to represent characters on the display. */
+
+/* The low eight bits are the character code, and the bits above them
+ are the numeric face ID. If FID is the face ID of a glyph on a
+ frame F, then F->display.x->faces[FID] contains the description of
+ that face. This is an int instead of a short, so we can support a
+ good bunch of face ID's; given that we have no mechanism for
+ tossing unused frame face ID's yet, we'll probably run out of 255
+ pretty quickly. */
+#define GLYPH unsigned int
+
+#ifdef HAVE_X_WINDOWS
+/* The FAST macros assume that we already know we're in an X window. */
+
+/* Given a character code and a face ID, return the appropriate glyph. */
+#define FAST_MAKE_GLYPH(char, face) ((char) | ((face) << 8))
+
+/* Return a glyph's character code. */
+#define FAST_GLYPH_CHAR(glyph) ((glyph) & 0xff)
+
+/* Return a glyph's face ID. */
+#define FAST_GLYPH_FACE(glyph) (((glyph) >> 8) & ((1 << 24) - 1))
+
+/* Slower versions that test the frame type first. */
+#define MAKE_GLYPH(f, char, face) (FRAME_TERMCAP_P (f) ? (char) \
+ : FAST_MAKE_GLYPH (char, face))
+#define GLYPH_CHAR(f, g) (FRAME_TERMCAP_P (f) ? (g) : FAST_GLYPH_CHAR (g))
+#define GLYPH_FACE(f, g) (FRAME_TERMCAP_P (f) ? (0) : FAST_GLYPH_FACE (g))
+#else
+#define MAKE_GLYPH(f, char, face) (char)
+#define GLYPH_CHAR(f, g) (g)
+#define GLYPH_FACE(f, g) (g)
+#endif
+
+/* The ID of the mode line highlighting face. */
+#define GLYPH_MODE_LINE_FACE 1