]> code.delx.au - gnu-emacs/blobdiff - src/dispextern.h
(print_error_message): Print data of `end-of-file'
[gnu-emacs] / src / dispextern.h
index e27937db7a28449791d7a5d4f097317bd0901810..ad32c70360f4e2175707d26566e2efc70cf7c4c3 100644 (file)
@@ -130,21 +130,27 @@ struct text_pos
 
 /* Increment text position POS.  */
 
-#define INC_TEXT_POS(POS)                      \
+#define INC_TEXT_POS(POS, MULTIBYTE_P)         \
      do                                                \
        {                                       \
         ++(POS).charpos;                       \
-        INC_POS ((POS).bytepos);               \
+         if (MULTIBYTE_P)                      \
+          INC_POS ((POS).bytepos);             \
+        else                                   \
+          ++(POS).bytepos;                     \
        }                                       \
      while (0)
 
 /* Decrement text position POS.  */
 
-#define DEC_TEXT_POS(POS)                      \
+#define DEC_TEXT_POS(POS, MULTIBYTE_P)         \
      do                                                \
        {                                       \
         --(POS).charpos;                       \
-        DEC_POS ((POS).bytepos);               \
+         if (MULTIBYTE_P)                      \
+          DEC_POS ((POS).bytepos);             \
+        else                                   \
+          --(POS).bytepos;                     \
        }                                       \
      while (0)
 
@@ -207,6 +213,9 @@ enum glyph_type
   /* Glyph describes a character.  */
   CHAR_GLYPH,  
 
+  /* Glyph describes a composition sequence.  */
+  COMPOSITE_GLYPH,
+
   /* Glyph describes an image.  */
   IMAGE_GLYPH,
 
@@ -257,51 +266,42 @@ struct glyph
      glyphs above or below it.  */
   unsigned overlaps_vertically_p : 1;
 
+  /* 1 means glyph is a padding glyph.  Padding glyphs are used for
+     characters whose visual shape consists of more than one glyph
+     (e.g. Asian characters).  All but the first glyph of such a glyph
+     sequence have the padding_p flag set.  Only used for terminal
+     frames, and there only to minimize code changes.  A better way
+     would probably be to use the width field of glyphs to express
+     padding. */
+  unsigned padding_p : 1;
+
+  /* 1 means the actual glyph is not available in the current
+     system.  */
+  unsigned glyph_not_available_p : 1;
+
+  /* Face of the glyph.  */
+  unsigned face_id : 22;
+
   /* A union of sub-structures for different glyph types.  */
   union
   {
-    /* Sub-structure for character glyphs (type == CHAR_GLYPH).  */
-    struct 
-    {
-      /* Character code.  */
-      unsigned code : 19;
-
-      /* Character's face.  */
-      unsigned face_id : 11;
-
-      /* 1 means glyph is a padding glyph.  Padding glyphs are used
-        for characters whose visual shape consists of more than one
-        glyph (e.g. Asian characters).  All but the first glyph of
-        such a glyph sequence have the padding_p flag set.  Only used
-        for terminal frames, and there only to minimize code changes.
-        A better way would probably be to use the width field of
-        glyphs to express padding.  */
-      unsigned padding_p : 1;
-    }
-    ch;
+    /* Character code for character glyphs (type == CHAR_GLYPH).  */
+    unsigned ch;
 
-    /* Sub-structure for image glyphs (type == IMAGE_GLYPH).  */
-    struct
-    {
-      /* Image id.  */
-      unsigned id : 20;
+    /* Composition ID for composition glyphs (type == COMPOSITION_GLYPH)  */
+    unsigned cmp_id;
 
-      /* Face under the image.  */
-      unsigned face_id : 12;
-    }
-    img;
+    /* Image ID for image glyphs (type == IMAGE_GLYPH).  */
+    unsigned img_id;
 
     /* Sub-structure for type == STRETCH_GLYPH.  */
     struct
     {
       /* The height of the glyph.  */
-      unsigned height  : 11;
+      unsigned height  : 16;
 
       /* The ascent of the glyph.  */
-      unsigned ascent  : 10;
-
-      /* The face of the stretch glyph.  */
-      unsigned face_id : 11;
+      unsigned ascent  : 16;
     }
     stretch;
     
@@ -321,19 +321,28 @@ struct glyph
 #define GLYPH_EQUAL_P(X, Y)                                    \
      ((X)->type == (Y)->type                                   \
       && (X)->u.val == (Y)->u.val                              \
+      && (X)->face_id == (Y)->face_id                          \
+      && (X)->padding_p == (Y)->padding_p                      \
       && (X)->left_box_line_p == (Y)->left_box_line_p          \
       && (X)->right_box_line_p == (Y)->right_box_line_p                \
       && (X)->voffset == (Y)->voffset)
 
+/* Are character codes, faces, padding_ps of glyphs *X and *Y equal?  */
+
+#define GLYPH_CHAR_AND_FACE_EQUAL_P(X, Y)      \
+  ((X)->u.ch == (Y)->u.ch                      \
+   && (X)->face_id == (Y)->face_id             \
+   && (X)->padding_p == (Y)->padding_p)
+
 /* Fill a character glyph GLYPH.  CODE, FACE_ID, PADDING_P correspond
    to the bits defined for the typedef `GLYPH' in lisp.h.  */
      
 #define SET_CHAR_GLYPH(GLYPH, CODE, FACE_ID, PADDING_P)        \
      do                                                        \
        {                                               \
-         (GLYPH).u.ch.code = (CODE);                   \
-         (GLYPH).u.ch.face_id = (FACE_ID);             \
-         (GLYPH).u.ch.padding_p = (PADDING_P);         \
+         (GLYPH).u.ch = (CODE);                                \
+         (GLYPH).face_id = (FACE_ID);                  \
+         (GLYPH).padding_p = (PADDING_P);              \
        }                                               \
      while (0)
 
@@ -344,18 +353,20 @@ struct glyph
      SET_CHAR_GLYPH ((GLYPH),                                  \
                     FAST_GLYPH_CHAR ((FROM)),                  \
                     FAST_GLYPH_FACE ((FROM)),                  \
-                    ((FROM) & GLYPH_MASK_PADDING) != 0)
+                    0)
 
-/* Construct a typedef'd GLYPH value from a character glyph GLYPH.  */
+/* Construct a glyph code from a character glyph GLYPH.  If the
+   character is multibyte, return -1 as we can't use glyph table for a
+   multibyte character. */
      
-#define GLYPH_FROM_CHAR_GLYPH(GLYPH)                           \
-     ((GLYPH).u.ch.code                                                \
-       | ((GLYPH).u.ch.face_id << CHARACTERBITS)               \
-       | ((GLYPH).u.ch.padding_p ? GLYPH_MASK_PADDING : 0))
+#define GLYPH_FROM_CHAR_GLYPH(GLYPH)           \
+  ((GLYPH).u.ch < 256                          \
+   ? ((GLYPH).u.ch | ((GLYPH).face_id << 8))   \
+   : -1)
 
 /* Is GLYPH a padding glyph?  */
      
-#define CHAR_GLYPH_PADDING_P(GLYPH) (GLYPH).u.ch.padding_p
+#define CHAR_GLYPH_PADDING_P(GLYPH) (GLYPH).padding_p
 
 
 
@@ -1055,6 +1066,7 @@ extern struct glyph_row scratch_glyph_row;
      (!MINI_WINDOW_P (W)                                               \
       && !(W)->pseudo_window_p                                         \
       && FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME (W)))            \
+      && BUFFERP ((W)->buffer)                                         \
       && !NILP (XBUFFER ((W)->buffer)->mode_line_format))
 
 /* Value is non-zero if window W wants a top line.  */
@@ -1063,6 +1075,7 @@ extern struct glyph_row scratch_glyph_row;
      (!MINI_WINDOW_P (W)                                               \
       && !(W)->pseudo_window_p                                         \
       && FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME (W)))            \
+      && BUFFERP ((W)->buffer)                                         \
       && !NILP (XBUFFER ((W)->buffer)->header_line_format))
 
 \f     
@@ -1088,6 +1101,7 @@ enum lface_attribute_index
   LFACE_OVERLINE_INDEX,
   LFACE_STRIKE_THROUGH_INDEX,
   LFACE_BOX_INDEX,
+  LFACE_FONT_INDEX,
   LFACE_VECTOR_SIZE
 };
 
@@ -1165,9 +1179,6 @@ struct face
      must not be freed.  */
   char *font_name;
 
-  /* The X font registry and encoding of font_name.  */
-  Lisp_Object registry;
-
   /* Font info ID for this face's font.  An ID is stored here because
      pointers to font_info structures may change.  The reason is that
      they are pointers into a font table vector that is itself
@@ -1175,8 +1186,8 @@ struct face
   int font_info_id;
 
   /* Fontset ID if this face uses a fontset, or -1.  This is only >= 0
-     if the face was realized for CHARSET_COMPOSITION.  For all other
-     charsets, a specific font is loaded from the set of fonts
+     if the face was realized for a composition sequence.
+     Otherwise, a specific font is loaded from the set of fonts
      specified by the fontset given by the family attribute of the face.  */
   int fontset;
   
@@ -1206,10 +1217,10 @@ struct face
   unsigned hash;
 
   /* The charset for which this face was realized if it was realized
-     for use in multibyte text.  If fontset >= 0, this is
-     CHARSET_COMPOSITION.  A value of charset < 0 means the face was
-     realized for use in unibyte text where the idea of Emacs
-     charsets isn't applicable.  */
+     for use in multibyte text.  If fontset >= 0, this is the charset
+     of the first character of the composition sequence.  A value of
+     charset < 0 means the face was realized for use in unibyte text
+     where the idea of Emacs charsets isn't applicable.  */
   int charset;
 
   /* Non-zero if text in this face should be underlined, overlined,
@@ -1248,6 +1259,10 @@ struct face
 
   /* Next and previous face in hash collision list of face cache.  */
   struct face *next, *prev;
+
+  /* If this face is for ASCII characters, this points this face
+     itself.  Otherwise, this points a face for ASCII characters.  */
+  struct face *ascii_face;
 };
 
 
@@ -1255,6 +1270,14 @@ struct face
 
 #define FACE_TTY_DEFAULT_COLOR ((unsigned long) -1)
 
+/* Color index indicating that face uses an unknown foreground color.  */
+
+#define FACE_TTY_DEFAULT_FG_COLOR ((unsigned long) -2)
+
+/* Color index indicating that face uses an unsigned background color.  */
+
+#define FACE_TTY_DEFAULT_BG_COLOR ((unsigned long) -3)
+
 /* Non-zero if FACE was realized for unibyte use.  */
 
 #define FACE_UNIBYTE_P(FACE) ((FACE)->charset < 0)
@@ -1311,37 +1334,34 @@ struct face_cache
    face doesn't exist.  */
 
 #define FACE_FROM_ID(F, ID)                            \
-     (((ID) >= 0 && (ID) < FRAME_FACE_CACHE (F)->used) \
+     (((unsigned) (ID) < FRAME_FACE_CACHE (F)->used)   \
       ? FRAME_FACE_CACHE (F)->faces_by_id[ID]          \
       : NULL)
 
-/* Non-zero if FACE is suitable for displaying characters of CHARSET.
-   CHARSET < 0 means unibyte text.  */
-
-#define FACE_SUITABLE_FOR_CHARSET_P(FACE, CHARSET)                     \
-     (((CHARSET) < 0                                                   \
-       ? (EQ ((FACE)->registry, Vface_default_registry)                        \
-         || !NILP (Fequal ((FACE)->registry, Vface_default_registry))) \
-       : ((FACE)->charset == (CHARSET)                                 \
-         || ((FACE)->charset == CHARSET_ASCII                          \
-             && (CHARSET) == charset_latin_iso8859_1                   \
-             && face_suitable_for_iso8859_1_p ((FACE)))                \
-         || ((FACE)->charset == charset_latin_iso8859_1                \
-             && (CHARSET) == CHARSET_ASCII))))
-     
+#ifdef HAVE_WINDOW_SYSTEM
+
+/* Non-zero if FACE is suitable for displaying character CHAR.  */
+
+#define FACE_SUITABLE_FOR_CHAR_P(FACE, CHAR)   \
+  (SINGLE_BYTE_CHAR_P (CHAR)                   \
+   ? (FACE) == (FACE)->ascii_face              \
+   : face_suitable_for_char_p ((FACE), (CHAR)))
+
 /* Return the id of the realized face on frame F that is like the face
-   with id ID but is suitable for displaying characters of CHARSET.
-   This macro is only meaningful for CHARSET >= 0, i.e. multibyte
-   text.  */
+   with id ID but is suitable for displaying character CHAR.
+   This macro is only meaningful for multibyte character CHAR.  */
    
-#define FACE_FOR_CHARSET(F, ID, CHARSET)                               \
-     (FACE_SUITABLE_FOR_CHARSET_P (FACE_FROM_ID ((F), (ID)), (CHARSET))        \
-      ? (ID)                                                           \
-      : lookup_face ((F), FACE_FROM_ID ((F), (ID))->lface, (CHARSET)))
+#define FACE_FOR_CHAR(F, FACE, CHAR)   \
+  (SINGLE_BYTE_CHAR_P (CHAR)           \
+   ? (FACE)->ascii_face->id            \
+   : face_for_char ((F), (FACE), (CHAR)))
 
-/* The default registry and encoding to use.  */
+#else /* not HAVE_WINDOW_SYSTEM */
+
+#define FACE_SUITABLE_FOR_CHAR_P(FACE, CHAR) 1
+#define FACE_FOR_CHAR(F, FACE, CHAR) ((FACE)->id)
 
-extern Lisp_Object Vface_default_registry;
+#endif /* not HAVE_WINDOW_SYSTEM */
 
 /* Non-zero means face attributes have been changed since the last
    redisplay.  Used in redisplay_internal.  */
@@ -1403,6 +1423,9 @@ enum display_element_type
   /* A normal character.  */
   IT_CHARACTER,
 
+  /* A composition sequence.  */
+  IT_COMPOSITION,
+
   /* An image.  */
   IT_IMAGE,
 
@@ -1431,6 +1454,7 @@ enum prop_idx
   FACE_PROP_IDX,
   INVISIBLE_PROP_IDX,
   DISPLAY_PROP_IDX,
+  COMPOSITION_PROP_IDX,
 
   /* Not a property.  Used to indicate changes in overlays.  */
   OVERLAY_PROP_IDX,
@@ -1588,6 +1612,10 @@ struct it
   /* 1 means overlay strings at end_charpos have been processed.  */
   unsigned overlay_strings_at_end_processed_p : 1;
 
+  /* 1 means the actual glyph is not available in the current
+     system.  */
+  unsigned glyph_not_available_p : 1; 
+
   /* The ID of the default face to use.  One of DEFAULT_FACE_ID,
      MODE_LINE_FACE_ID, or TOOL_BAR_FACE_ID, depending on what we
      are displaying.  */
@@ -1596,18 +1624,21 @@ struct it
   /* If what == IT_CHARACTER, character and length in bytes.  This is
      a character from a buffer or string.  It may be different from
      the character displayed in case that
-     unibyte_display_via_language_environment is set.  */
+     unibyte_display_via_language_environment is set.
+
+     If what == IT_COMPOSITION, the first component of a composition
+     and length in bytes of the composition.  */
   int c, len;
 
+  /* If what == IT_COMPOSITION, identification number and length in
+     chars of a composition.  */
+  int cmp_id, cmp_len;
+
   /* The character to display, possibly translated to multibyte
      if unibyte_display_via_language_environment is set.  This
      is set after x_produce_glyphs has been called.  */
   int char_to_display;
 
-  /* Charset for which face_id was computed.  This is the charset
-     of char_to_display after x_produce_glyphs has been called.  */
-  int charset;
-
   /* If what == IT_IMAGE, the id of the image to display.  */
   int image_id;
 
@@ -1645,10 +1676,9 @@ struct it
      line, if the window has one.  */
   int last_visible_y;
 
-  /* Width of a prompt in front of the line.  Used to perform tab
-     calculations.  The x on which tab calculations are based is
-     current_x - prompt_width + continuation_lines_width.  */
-  int prompt_width;
+  /* Additional space in pixels between lines (for window systems
+     only.).  */
+  int extra_line_spacing;
 
   /* If non-null, glyphs are produced in glyph_row with each call to
      produce_glyphs.  */
@@ -1831,7 +1861,7 @@ extern int (* estimate_mode_line_height_hook) P_ ((struct frame *,
                                Images
  ***********************************************************************/
 
-#ifdef HAVE_X_WINDOWS
+#ifdef HAVE_WINDOW_SYSTEM
 
 /* Structure forward declarations.  */
 
@@ -1903,6 +1933,9 @@ struct image
   /* Reference to the type of the image.  */
   struct image_type *type;
 
+  /* 1 means that loading the image failed.  Don't try again.  */
+  unsigned load_failed_p;
+
   /* A place for image types to store additional data.  The member
      data.lisp_val is marked during GC, so it's safe to store Lisp data
      there.  Image types should free this data when their `free'
@@ -1964,7 +1997,7 @@ struct image_cache
 
 #define IMAGE_CACHE_BUCKETS_SIZE 1001
 
-#endif /* HAVE_X_WINDOWS */
+#endif /* HAVE_WINDOW_SYSTEM */
 
 
 \f
@@ -2089,10 +2122,13 @@ void init_sigio P_ ((int));
 #ifdef USE_X_TOOLKIT
 void x_set_menu_resources_from_menu_face P_ ((struct frame *, Widget));
 #endif
+#ifdef HAVE_X_WINDOWS
+void x_free_colors P_ ((struct frame *, unsigned long *, int));
+#endif
 
 void update_face_from_frame_parameter P_ ((struct frame *, Lisp_Object,
                                           Lisp_Object));
-char *x_charset_registry P_ ((int));
+Lisp_Object tty_color_name P_ ((struct frame *, int));
 void clear_face_cache P_ ((int));
 unsigned long load_color P_ ((struct frame *, struct face *, Lisp_Object,
                              enum lface_attribute_index));
@@ -2100,10 +2136,8 @@ void unload_color P_ ((struct frame *, unsigned long));
 int frame_update_line_height P_ ((struct frame *));
 int ascii_face_of_lisp_face P_ ((struct frame *, int));
 void prepare_face_for_display P_ ((struct frame *, struct face *));
-int face_suitable_for_iso8859_1_p P_ ((struct face *));
 int xstricmp P_ ((unsigned char *, unsigned char *));
-int lookup_face P_ ((struct frame *, Lisp_Object *, int));
-int face_suitable_for_charset_p P_ ((struct face *, int));
+int lookup_face P_ ((struct frame *, Lisp_Object *, int, struct face *));
 int lookup_named_face P_ ((struct frame *, Lisp_Object, int));
 int smaller_face P_ ((struct frame *, int, int));
 int face_with_height P_ ((struct frame *, int, int));
@@ -2118,12 +2152,19 @@ int face_at_string_position P_ ((struct window *, Lisp_Object,
 int compute_char_face P_ ((struct frame *, int, Lisp_Object));
 void free_all_realized_faces P_ ((Lisp_Object));
 extern Lisp_Object Qforeground_color, Qbackground_color;
+void free_realized_multibyte_face P_ ((struct frame *, int));
 
 /* Defined in xfns.c  */
 
-#ifdef HAVE_X_WINDOWS 
-
+#ifdef HAVE_X_WINDOWS
 void gamma_correct P_ ((struct frame *, XColor *));
+#endif
+#ifdef WINDOWSNT
+void gamma_correct P_ ((struct frame *, COLORREF *));
+#endif
+
+#ifdef HAVE_WINDOW_SYSTEM
+
 void x_kill_gs_process P_ ((Pixmap, struct frame *));
 int x_screen_planes P_ ((struct frame *));
 void x_implicitly_set_name P_ ((struct frame *, Lisp_Object, Lisp_Object));
@@ -2139,12 +2180,11 @@ extern struct frame *tip_frame;
 extern Window tip_window;
 EXFUN (Fx_show_tip, 4);
 EXFUN (Fx_hide_tip, 0);
-EXFUN (Fx_show_busy_cursor, 0);
-EXFUN (Fx_hide_busy_cursor, 1);
-extern int inhibit_busy_cursor;
+extern void start_busy_cursor P_ ((void));
+extern void cancel_busy_cursor P_ ((void));
 extern int display_busy_cursor_p;
 
-#endif /* HAVE_X_WINDOWS */
+#endif /* HAVE_WINDOW_SYSTEM */
 
 
 /* Defined in xmenu.c  */
@@ -2176,10 +2216,10 @@ void clear_desired_matrices P_ ((struct frame *));
 void shift_glyph_matrix P_ ((struct window *, struct glyph_matrix *,
                             int, int, int));
 void rotate_matrix P_ ((struct glyph_matrix *, int, int, int));
-void increment_glyph_matrix_buffer_positions P_ ((struct glyph_matrix *,
-                                                 int, int, int, int));
+void increment_matrix_positions P_ ((struct glyph_matrix *,
+                                    int, int, int, int));
 void blank_row P_ ((struct window *, struct glyph_row *, int));
-void increment_glyph_row_buffer_positions P_ ((struct glyph_row *, int, int));
+void increment_row_positions P_ ((struct glyph_row *, int, int));
 void enable_glyph_matrix_rows P_ ((struct glyph_matrix *, int, int, int));
 void clear_glyph_row P_ ((struct glyph_row *));
 void prepare_desired_row P_ ((struct glyph_row *));