Generalize run-time debugging checks.
[bpt/emacs.git] / src / dispextern.h
index b1c3d62..78f6db6 100644 (file)
@@ -1,6 +1,6 @@
 /* Interface definitions for display code.
 
-Copyright (C) 1985, 1993-1994, 1997-2011  Free Software Foundation, Inc.
+Copyright (C) 1985, 1993-1994, 1997-2012  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -68,6 +68,10 @@ typedef Pixmap XImagePtr;
 typedef XImagePtr XImagePtr_or_DC;
 #endif
 
+#ifdef HAVE_WINDOW_SYSTEM
+# include "systime.h"
+#endif
+
 #ifndef HAVE_WINDOW_SYSTEM
 typedef int Cursor;
 #define No_Cursor (0)
@@ -124,13 +128,6 @@ enum window_part
 #define GLYPH_DEBUG 0
 #endif
 
-/* If XASSERTS is non-zero, additional consistency checks are activated.
-   Turn it off by defining the macro XASSERTS to zero.  */
-
-#ifndef XASSERTS
-#define XASSERTS 0
-#endif
-
 /* Macros to include code only if GLYPH_DEBUG != 0.  */
 
 #if GLYPH_DEBUG
@@ -139,12 +136,6 @@ enum window_part
 #define IF_DEBUG(X)    (void) 0
 #endif
 
-#if XASSERTS
-#define xassert(X)     do {if (!(X)) abort ();} while (0)
-#else
-#define xassert(X)     (void) 0
-#endif
-
 /* Macro for displaying traces of redisplay.  If Emacs was compiled
    with GLYPH_DEBUG != 0, the variable trace_redisplay_p can be set to
    a non-zero value in debugging sessions to activate traces.  */
@@ -405,7 +396,7 @@ struct glyph
   {
     /* Metrics of a partial glyph of an image (type == IMAGE_GLYPH).  */
     struct glyph_slice img;
-    /* Start and end indices of glyphs of a graphme cluster of a
+    /* Start and end indices of glyphs of a grapheme cluster of a
        composition (type == COMPOSITE_GLYPH).  */
     struct { int from, to; } cmp;
     /* Pixel offsets for upper and lower part of the acronym.  */
@@ -454,7 +445,7 @@ struct glyph
       /* Length of acronym or hexadecimal code string (at most 8).  */
       unsigned len : 4;
       /* Character to display.  Actually we need only 22 bits.  */
-      unsigned ch : 26;
+      unsigned ch : 25;
     } glyphless;
 
     /* Used to compare all bit-fields above in one step.  */
@@ -1510,6 +1501,13 @@ enum face_box_type
   FACE_SUNKEN_BOX
 };
 
+/* Underline type. */
+
+enum face_underline_type
+{
+  FACE_UNDER_LINE,
+  FACE_UNDER_WAVE
+};
 
 /* Structure describing a realized face.
 
@@ -1585,6 +1583,9 @@ struct face
      drawing shadows.  */
   unsigned use_box_color_for_shadows_p : 1;
 
+  /* Style of underlining. */
+  enum face_underline_type underline_type;
+
   /* Non-zero if text in this face should be underlined, overlined,
      strike-through or have a box drawn around it.  */
   unsigned underline_p : 1;
@@ -1609,15 +1610,12 @@ struct face
   unsigned strike_through_color_defaulted_p : 1;
   unsigned box_color_defaulted_p : 1;
 
-  /* TTY appearances.  Blinking is not yet implemented.  Colors are
-     found in `lface' with empty color string meaning the default
-     color of the TTY.  */
+  /* TTY appearances.  Colors are found in `lface' with empty color
+     string meaning the default color of the TTY.  */
   unsigned tty_bold_p : 1;
-  unsigned tty_dim_p : 1;
+  unsigned tty_italic_p : 1;
   unsigned tty_underline_p : 1;
-  unsigned tty_alt_charset_p : 1;
   unsigned tty_reverse_p : 1;
-  unsigned tty_blinking_p : 1;
 
   /* 1 means that colors of this face may not be freed because they
      have been copied bitwise from a base face (see
@@ -2152,6 +2150,10 @@ struct it
      Don't handle some `display' properties in these strings.  */
   unsigned string_from_display_prop_p : 1;
 
+  /* 1 means `string' comes from a `line-prefix' or `wrap-prefix'
+     property.  */
+  unsigned string_from_prefix_prop_p : 1;
+
   /* 1 means we are iterating an object that came from a value of a
      `display' property.  */
   unsigned from_disp_prop_p : 1;
@@ -2204,7 +2206,11 @@ struct it
   struct display_pos current;
 
   /* Total number of overlay strings to process.  This can be >
-     OVERLAY_STRING_CHUNK_SIZE.  */
+     OVERLAY_STRING_CHUNK_SIZE.  Value is dependable only when
+     current.overlay_string_index >= 0.  Use the latter to determine
+     whether an overlay string is being iterated over, because
+     n_overlay_strings can be positive even when we are not rendering
+     an overlay string.  */
   ptrdiff_t n_overlay_strings;
 
   /* The charpos where n_overlay_strings was calculated.  This should
@@ -2223,7 +2229,8 @@ struct it
 
   /* If non-nil, a Lisp string being processed.  If
      current.overlay_string_index >= 0, this is an overlay string from
-     pos.  */
+     pos.  Use STRINGP (it.string) to test whether we are rendering a
+     string or something else; do NOT use BUFFERP (it.object).  */
   Lisp_Object string;
 
   /* If non-nil, we are processing a string that came
@@ -2272,6 +2279,7 @@ struct it
     bidi_dir_t paragraph_embedding;
     unsigned multibyte_p : 1;
     unsigned string_from_display_prop_p : 1;
+    unsigned string_from_prefix_prop_p : 1;
     unsigned display_ellipsis_p : 1;
     unsigned avoid_cursor_p : 1;
     unsigned bidi_p:1;
@@ -2411,6 +2419,9 @@ struct it
      and continuation glyphs, or blanks that extend each line to the
      edge of the window on a TTY.
 
+     Do NOT use !BUFFERP (it.object) as a test whether we are
+     iterating over a string; use STRINGP (it.string) instead.
+
      Position is the current iterator position in object.  */
   Lisp_Object object;
   struct text_pos position;
@@ -2649,11 +2660,11 @@ struct redisplay_interface
   void (*flush_display) (struct frame *f);
 
   /* Flush the display of frame F if non-NULL.  This is called
-     during redisplay, and should be NULL on systems which flushes
+     during redisplay, and should be NULL on systems which flush
      automatically before reading input.  */
   void (*flush_display_optional) (struct frame *f);
 
-  /* Clear the mouse hightlight in window W, if there is any.  */
+  /* Clear the mouse highlight in window W, if there is any.  */
   void (*clear_window_mouse_face) (struct window *w);
 
   /* Set *LEFT and *RIGHT to the left and right overhang of GLYPH on
@@ -2760,7 +2771,7 @@ struct image
 {
   /* The time in seconds at which the image was last displayed.  Set
      in prepare_image_for_display.  */
-  time_t timestamp;
+  EMACS_TIME timestamp;
 
   /* Pixmaps of the image.  */
   Pixmap pixmap, mask;
@@ -2974,8 +2985,7 @@ enum tool_bar_item_image
 #define TTY_CAP_UNDERLINE      0x02
 #define TTY_CAP_BOLD           0x04
 #define TTY_CAP_DIM            0x08
-#define TTY_CAP_BLINK          0x10
-#define TTY_CAP_ALT_CHARSET    0x20
+#define TTY_CAP_ITALIC         0x10
 
 \f
 /***********************************************************************
@@ -3126,6 +3136,9 @@ void compute_fringe_widths (struct frame *, int);
 void w32_init_fringe (struct redisplay_interface *);
 void w32_reset_fringes (void);
 #endif
+
+extern unsigned row_hash (struct glyph_row *);
+
 /* Defined in image.c */
 
 #ifdef HAVE_WINDOW_SYSTEM
@@ -3190,7 +3203,11 @@ void unload_color (struct frame *, unsigned long);
 char *choose_face_font (struct frame *, Lisp_Object *, Lisp_Object,
                         int *);
 void prepare_face_for_display (struct frame *, struct face *);
+#ifdef HAVE_STRCASECMP
+#define xstrcasecmp(x,y) strcasecmp ((x), (y))
+#else
 int xstrcasecmp (const char *, const char *);
+#endif
 int lookup_named_face (struct frame *, Lisp_Object, int);
 int lookup_basic_face (struct frame *, int);
 int smaller_face (struct frame *, int, int);
@@ -3235,7 +3252,6 @@ extern Window tip_window;
 EXFUN (Fx_hide_tip, 0);
 extern void start_hourglass (void);
 extern void cancel_hourglass (void);
-extern int hourglass_started (void);
 extern int hourglass_shown_p;
 struct atimer;                 /* Defined in atimer.h.  */
 /* If non-null, an asynchronous timer that, when it expires, displays