* lisp/progmodes/js.el: Add notes in comments.
[bpt/emacs.git] / src / dispextern.h
index 997ef6d..c765250 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.
 
@@ -151,7 +151,7 @@ enum window_part
 
 #if GLYPH_DEBUG
 
-extern int trace_redisplay_p;
+extern int trace_redisplay_p EXTERNALLY_VISIBLE;
 #include <stdio.h>
 
 #define TRACE(X)                               \
@@ -405,7 +405,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 +454,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.  */
@@ -575,7 +575,7 @@ struct glyph_pool
   struct glyph *glyphs;
 
   /* Allocated size of `glyphs'.  */
-  int nglyphs;
+  ptrdiff_t nglyphs;
 
   /* Number of rows and columns in a matrix.  */
   int nrows, ncolumns;
@@ -625,7 +625,7 @@ struct glyph_matrix
   struct glyph_row *rows;
 
   /* Number of elements allocated for the vector rows above.  */
-  int rows_allocated;
+  ptrdiff_t rows_allocated;
 
   /* The number of rows used by the window if all lines were displayed
      with the smallest possible character height.  */
@@ -845,6 +845,10 @@ struct glyph_row
   /* Vertical offset of the right fringe bitmap.  */
   signed right_fringe_offset : FRINGE_HEIGHT_BITS;
 
+  /* 1 means that at least one of the left and right fringe bitmaps is
+     periodic and thus depends on the y-position of the row.  */
+  unsigned fringe_bitmap_periodic_p : 1;
+
   /* 1 means that we must draw the bitmaps of this row.  */
   unsigned redraw_fringe_bitmaps_p : 1;
 
@@ -1236,7 +1240,7 @@ struct glyph_string
   struct composition *cmp;
 
   /* If not negative, this string describes a compos.  */
-  int cmp_id;
+  ptrdiff_t cmp_id;
 
   /* Start and end glyph indices in a glyph-string.  */
   int cmp_from, cmp_to;
@@ -1279,10 +1283,10 @@ struct glyph_string
   unsigned padding_p : 1;
 
   /* The GC to use for drawing this glyph string.  */
-#if defined(HAVE_X_WINDOWS)
+#if defined (HAVE_X_WINDOWS)
   GC gc;
 #endif
-#if defined(HAVE_NTGUI)
+#if defined (HAVE_NTGUI)
   XGCValues *gc;
   HDC hdc;
 #endif
@@ -1528,12 +1532,12 @@ struct face
 
   /* Background stipple or bitmap used for this face.  This is
      an id as returned from load_pixmap.  */
-  int stipple;
+  ptrdiff_t stipple;
 
 #else /* not HAVE_WINDOW_SYSTEM */
 
   /* Dummy.  */
-  int stipple;
+  ptrdiff_t stipple;
 
 #endif /* not HAVE_WINDOW_SYSTEM */
 
@@ -1704,7 +1708,8 @@ struct face_cache
   struct face **faces_by_id;
 
   /* The allocated size, and number of used slots of faces_by_id.  */
-  int size, used;
+  ptrdiff_t size;
+  int used;
 
   /* Flag indicating that attributes of the `menu' face have been
      changed.  */
@@ -1725,7 +1730,7 @@ struct face_cache
    face doesn't exist.  */
 
 #define FACE_FROM_ID(F, ID)                            \
-     (((unsigned) (ID) < FRAME_FACE_CACHE (F)->used)   \
+     (UNSIGNED_CMP (ID, <, FRAME_FACE_CACHE (F)->used) \
       ? FRAME_FACE_CACHE (F)->faces_by_id[ID]          \
       : NULL)
 
@@ -1769,7 +1774,11 @@ extern int face_change_count;
 /* Data type for describing the bidirectional character types.  The
    first 7 must be at the beginning, because they are the only values
    valid in the `bidi_type' member of `struct glyph'; we only reserve
-   3 bits for it, so we cannot use there values larger than 7.  */
+   3 bits for it, so we cannot use there values larger than 7.
+
+   The order of members must be in sync with the 8th element of the
+   member of unidata-prop-alist (in admin/unidata/unidata-gen.el) for
+   Unicode character property `bidi-class'.  */
 typedef enum {
   UNKNOWN_BT = 0,
   STRONG_L,    /* strong left-to-right */
@@ -1847,10 +1856,15 @@ struct bidi_it {
   struct bidi_saved_info next_for_neutral; /* surrounding characters for... */
   struct bidi_saved_info prev_for_neutral; /* ...resolving neutrals */
   struct bidi_saved_info next_for_ws; /* character after sequence of ws */
-  EMACS_INT next_en_pos;       /* position of next EN char for ET */
+  EMACS_INT next_en_pos;       /* pos. of next char for determining ET type */
+  bidi_type_t next_en_type;    /* type of char at next_en_pos */
   EMACS_INT ignore_bn_limit;   /* position until which to ignore BNs */
   bidi_dir_t sor;              /* direction of start-of-run in effect */
   int scan_dir;                        /* direction of text scan, 1: forw, -1: back */
+  EMACS_INT disp_pos;          /* position of display string after ch */
+  int disp_prop;               /* if non-zero, there really is a
+                                  `display' property/string at disp_pos;
+                                  if 2, the property is a `space' spec */
   int stack_idx;               /* index of current data on the stack */
   /* Note: Everything from here on is not copied/saved when the bidi
      iterator state is saved, pushed, or popped.  So only put here
@@ -1859,7 +1873,6 @@ struct bidi_it {
   struct bidi_string_data string;      /* string to reorder */
   bidi_dir_t paragraph_dir;    /* current paragraph direction */
   EMACS_INT separator_limit;   /* where paragraph separator should end */
-  EMACS_INT disp_pos;          /* position of display string after ch */
   unsigned first_elt : 1;      /* if non-zero, examine current char first */
   unsigned new_paragraph : 1;  /* if non-zero, we expect a new paragraph */
   unsigned frame_window_p : 1; /* non-zero if displaying on a GUI frame */
@@ -2048,7 +2061,7 @@ struct composition_it
   EMACS_INT stop_pos;
   /* ID number of the composition or glyph-string.  If negative, we
      are not iterating over a composition now.  */
-  int id;
+  ptrdiff_t id;
   /* If non-negative, character that triggers the automatic
      composition at `stop_pos', and this is an automatic composition.
      If negative, this is a static composition.  This is set to -2
@@ -2139,6 +2152,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;
@@ -2198,7 +2215,7 @@ struct it
      be set at the same time as n_overlay_strings.  It is needed
      because we show before-strings at the start of invisible text;
      see handle_invisible_prop in xdisp.c.  */
-  int overlay_strings_charpos;
+  EMACS_INT overlay_strings_charpos;
 
   /* Vector of overlays to process.  Overlay strings are processed
      OVERLAY_STRING_CHUNK_SIZE at a time.  */
@@ -2238,7 +2255,7 @@ struct it
       struct {
        Lisp_Object object;
        struct it_slice slice;
-       int image_id;
+       ptrdiff_t image_id;
       } image;
       /* method == GET_FROM_COMPOSITION */
       struct {
@@ -2259,6 +2276,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;
@@ -2277,7 +2295,7 @@ struct it
 
   /* -1 means selective display hides everything between a \r and the
      next newline; > 0 means hide lines indented more than that value.  */
-  int selective;
+  EMACS_INT selective;
 
   /* An enumeration describing what the next display element is
      after a call to get_next_display_element.  */
@@ -2368,7 +2386,7 @@ struct it
   enum glyphless_display_method glyphless_method;
 
   /* If what == IT_IMAGE, the id of the image to display.  */
-  int image_id;
+  ptrdiff_t image_id;
 
   /* Values from `slice' property.  */
   struct it_slice slice;
@@ -2386,9 +2404,19 @@ struct it
   Lisp_Object font_height;
 
   /* Object and position where the current display element came from.
-     Object can be a Lisp string in case the current display element
-     comes from an overlay string, or it is buffer.  It may also be nil
-     during mode-line update.  Position is a position in object.  */
+     Object is normally the buffer which is being rendered, but it can
+     also be a Lisp string in case the current display element comes
+     from an overlay string or from a display string (before- or
+     after-string).  It may also be nil when a C string is being
+     rendered, e.g., during mode-line or header-line update.  It can
+     also be a cons cell of the form `(space ...)', when we produce a
+     stretch glyph from a `display' specification.  Finally, it can be
+     a zero-valued Lisp integer, but only temporarily, when we are
+     producing special glyphs for display purposes, like truncation
+     and continuation glyphs, or blanks that extend each line to the
+     edge of the window on a TTY.
+
+     Position is the current iterator position in object.  */
   Lisp_Object object;
   struct text_pos position;
 
@@ -2626,11 +2654,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
@@ -2737,7 +2765,7 @@ struct image
 {
   /* The time in seconds at which the image was last displayed.  Set
      in prepare_image_for_display.  */
-  unsigned long timestamp;
+  time_t timestamp;
 
   /* Pixmaps of the image.  */
   Pixmap pixmap, mask;
@@ -2810,22 +2838,15 @@ struct image
   /* 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'
-     function is called.  */
-  struct
-  {
-    int int_val;
-    void *ptr_val;
-    Lisp_Object lisp_val;
-  } data;
+  /* A place for image types to store additional data.  It is marked
+     during GC.  */
+  Lisp_Object lisp_data;
 
   /* Hash value of image specification to speed up comparisons.  */
-  unsigned hash;
+  EMACS_UINT hash;
 
   /* Image id of this image.  */
-  int id;
+  ptrdiff_t id;
 
   /* Hash collision chain.  */
   struct image *next, *prev;
@@ -2844,13 +2865,13 @@ struct image_cache
   struct image **images;
 
   /* Allocated size of `images'.  */
-  unsigned size;
+  ptrdiff_t size;
 
   /* Number of images in the cache.  */
-  unsigned used;
+  ptrdiff_t used;
 
   /* Reference count (number of frames sharing this cache).  */
-  int refcount;
+  ptrdiff_t refcount;
 };
 
 
@@ -2974,6 +2995,8 @@ extern void bidi_paragraph_init (bidi_dir_t, struct bidi_it *, int);
 extern int  bidi_mirror_char (int);
 extern void bidi_push_it (struct bidi_it *);
 extern void bidi_pop_it (struct bidi_it *);
+extern void *bidi_shelve_cache (void);
+extern void bidi_unshelve_cache (void *, int);
 
 /* Defined in xdisp.c */
 
@@ -3029,17 +3052,18 @@ extern struct frame *last_mouse_frame;
 extern int last_tool_bar_item;
 extern void reseat_at_previous_visible_line_start (struct it *);
 extern Lisp_Object lookup_glyphless_char_display (int, struct it *);
-extern int calc_pixel_width_or_height (double *, struct it *, Lisp_Object,
-                                       struct font *, int, int *);
 extern EMACS_INT compute_display_string_pos (struct text_pos *,
-                                            struct bidi_string_data *, int);
+                                            struct bidi_string_data *,
+                                            int, int *);
 extern EMACS_INT compute_display_string_end (EMACS_INT,
                                             struct bidi_string_data *);
+extern void produce_stretch_glyph (struct it *);
+
 
 #ifdef HAVE_WINDOW_SYSTEM
 
 #if GLYPH_DEBUG
-extern void dump_glyph_string (struct glyph_string *);
+extern void dump_glyph_string (struct glyph_string *) EXTERNALLY_VISIBLE;
 #endif
 
 extern void x_get_glyph_overhangs (struct glyph *, struct frame *,
@@ -3107,25 +3131,28 @@ 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
 
-extern int x_bitmap_height (struct frame *, int);
-extern int x_bitmap_width (struct frame *, int);
-extern int x_bitmap_pixmap (struct frame *, int);
-extern void x_reference_bitmap (struct frame *, int);
-extern int x_create_bitmap_from_data (struct frame *, char *,
-                                      unsigned int, unsigned int);
-extern int x_create_bitmap_from_file (struct frame *, Lisp_Object);
+extern int x_bitmap_height (struct frame *, ptrdiff_t);
+extern int x_bitmap_width (struct frame *, ptrdiff_t);
+extern int x_bitmap_pixmap (struct frame *, ptrdiff_t);
+extern void x_reference_bitmap (struct frame *, ptrdiff_t);
+extern ptrdiff_t x_create_bitmap_from_data (struct frame *, char *,
+                                           unsigned int, unsigned int);
+extern ptrdiff_t x_create_bitmap_from_file (struct frame *, Lisp_Object);
 #if defined HAVE_XPM && defined HAVE_X_WINDOWS && !defined USE_GTK
-extern int x_create_bitmap_from_xpm_data (struct frame *f, const char **bits);
+extern ptrdiff_t x_create_bitmap_from_xpm_data (struct frame *, const char **);
 #endif
 #ifndef x_destroy_bitmap
-extern void x_destroy_bitmap (struct frame *, int);
+extern void x_destroy_bitmap (struct frame *, ptrdiff_t);
 #endif
 extern void x_destroy_all_bitmaps (Display_Info *);
-extern int x_create_bitmap_mask (struct frame * , int);
+extern int x_create_bitmap_mask (struct frame *, ptrdiff_t);
 extern Lisp_Object x_find_image_file (Lisp_Object);
 
 void x_kill_gs_process (Pixmap, struct frame *);
@@ -3135,7 +3162,7 @@ void clear_image_caches (Lisp_Object);
 void mark_image_cache (struct image_cache *);
 int valid_image_p (Lisp_Object);
 void prepare_image_for_display (struct frame *, struct image *);
-int lookup_image (struct frame *, Lisp_Object);
+ptrdiff_t lookup_image (struct frame *, Lisp_Object);
 
 unsigned long image_background (struct image *, struct frame *,
                                 XImagePtr_or_DC ximg);
@@ -3192,11 +3219,10 @@ int face_at_string_position (struct window *w, Lisp_Object string,
                              EMACS_INT pos, EMACS_INT bufpos,
                              EMACS_INT region_beg, EMACS_INT region_end,
                              EMACS_INT *endptr, enum face_id, int mouse);
-int merge_faces (struct frame *, Lisp_Object, int, int);
+int merge_faces (struct frame *, Lisp_Object, EMACS_INT, int);
 int compute_char_face (struct frame *, int, Lisp_Object);
 void free_all_realized_faces (Lisp_Object);
 extern Lisp_Object Qforeground_color, Qbackground_color;
-extern Lisp_Object Qframe_set_background_mode;
 extern char unspecified_fg[], unspecified_bg[];
 
 /* Defined in xfns.c  */
@@ -3217,7 +3243,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
@@ -3328,8 +3353,10 @@ extern int tty_capable_p (struct tty_display_info *, unsigned, unsigned long, un
 extern void set_tty_color_mode (struct tty_display_info *, struct frame *);
 extern struct terminal *get_named_tty (const char *);
 EXFUN (Ftty_type, 1);
+EXFUN (Fcontrolling_tty_p, 1);
 extern void create_tty_output (struct frame *);
 extern struct terminal *init_tty (const char *, const char *, int);
+extern void tty_append_glyph (struct it *);
 
 
 /* Defined in scroll.c */