NOTE: This patch has been committed. The version below is
informational only (whitespace differences have been removed).
Dear reviewers,
here are again some new fixes for the DEFAULT_INDEX == 0
assumption. Oh boy. Do I miss C++ here :-(
src/ChangeLog addition:
2007-10-03 Didier Verna <didier(a)xemacs.org>
Again, fix some DEFAULT_INDEX == 0 assumptions. Actually, properly
initialize display_line structures.
* redisplay.h (DISPLAY_LINE_INIT): New macro. Properly initialize
the default_index field to DEFAULT_INDEX.
* frame.c (init_frame): Use it.
* redisplay.c (ensure_modeline_generated): Ditto.
* redisplay.c (generate_displayable_area): Ditto.
* redisplay.c (regenerate_window): Ditto.
* redisplay-output.c (sync_display_line_structs): Ditto.
* redisplay-output.c (redisplay_output_layout): Ditto.
XEmacs source patch:
Diff command: cvs -q diff -u -t -b -B -w
Files affected: src/redisplay-output.c src/redisplay.c src/redisplay.h src/frame.c
Index: src/frame.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/frame.c,v
retrieving revision 1.75
diff -u -u -t -b -B -w -r1.75 frame.c
--- src/frame.c 29 Aug 2006 14:10:54 -0000 1.75
+++ src/frame.c 3 Oct 2007 10:00:42 -0000
@@ -3605,7 +3605,7 @@
#endif
{
title_string_ichar_dynarr = Dynarr_new (Ichar);
- xzero (title_string_display_line);
+ DISPLAY_LINE_INIT (title_string_display_line);
}
}
Index: src/redisplay.h
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/redisplay.h,v
retrieving revision 1.24
diff -u -u -t -b -B -w -r1.24 redisplay.h
--- src/redisplay.h 26 Sep 2007 13:28:01 -0000 1.24
+++ src/redisplay.h 3 Oct 2007 10:00:42 -0000
@@ -329,6 +329,14 @@
face_index default_findex;
};
+#define DISPLAY_LINE_INIT(dl) \
+ do \
+ { \
+ xzero (dl); \
+ dl.default_findex = DEFAULT_INDEX; \
+ } \
+ while (0)
+
#define DISPLAY_LINE_HEIGHT(dl) \
(dl->ascent + dl->descent - (dl->clip + dl->top_clip))
#define DISPLAY_LINE_YPOS(dl) \
Index: src/redisplay.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/redisplay.c,v
retrieving revision 1.102
diff -u -u -t -b -B -w -r1.102 redisplay.c
--- src/redisplay.c 26 Sep 2007 13:28:01 -0000 1.102
+++ src/redisplay.c 3 Oct 2007 10:00:43 -0000
@@ -4529,7 +4529,8 @@
else
{
struct display_line modeline;
- xzero (modeline);
+
+ DISPLAY_LINE_INIT (modeline);
Dynarr_add (dla, modeline);
}
}
@@ -5355,8 +5356,7 @@
}
else
{
-
- xzero (dl);
+ DISPLAY_LINE_INIT (dl);
dlp = &dl;
local = 1;
}
@@ -5523,8 +5523,7 @@
}
else
{
-
- xzero (dl);
+ DISPLAY_LINE_INIT (dl);
dlp = &dl;
local = 1;
}
Index: src/redisplay-output.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/redisplay-output.c,v
retrieving revision 1.28
diff -u -u -t -b -B -w -r1.28 redisplay-output.c
--- src/redisplay-output.c 26 Sep 2007 13:28:01 -0000 1.28
+++ src/redisplay-output.c 3 Oct 2007 10:00:43 -0000
@@ -114,6 +114,9 @@
int db_elt;
int local = 0;
+ /* #### NOTE: practically, this is not needed because of the memcpy below.
+ #### However, it's cleaner and bugs-in-the-future proof. -- dvl */
+ DISPLAY_LINE_INIT (dl);
dlp = Dynarr_atp (ddla, line);
if (line >= Dynarr_largest (cdla))
{
@@ -1518,21 +1521,21 @@
IMAGE_INSTANCE_OPTIMIZE_OUTPUT (childii) =
IMAGE_INSTANCE_OPTIMIZE_OUTPUT (p);
- /* Although normalization is done by the output routines
- we have to do it here so that they don't try and
- clear all of db. This is true below also. */
+ /* Although normalization is done by the output routines we have to
+ do it here so that they don't try and clear all of db. This is
+ true below also. */
if (redisplay_normalize_glyph_area (&cdb, &cdga))
{
redisplay_normalize_display_box (&cdb, &cdga);
- /* Since the display boxes will now be totally in the
- window if they are visible at all we can now check this easily. */
+ /* Since the display boxes will now be totally in the window if
+ they are visible at all we can now check this easily. */
if (cdb.xpos < db->xpos || cdb.ypos < db->ypos
|| cdb.xpos + cdb.width > db->xpos + db->width
|| cdb.ypos + cdb.height > db->ypos + db->height)
continue;
- /* We have to invert the offset here as normalization
- will have made them positive which the output
- routines will treat as a truly +ve offset. */
+ /* We have to invert the offset here as normalization will have
+ made them positive which the output routines will treat as a
+ truly +ve offset. */
cdga.xoffset = -cdga.xoffset;
cdga.yoffset = -cdga.yoffset;
@@ -1551,7 +1554,10 @@
Lisp_Object string =
IMAGE_INSTANCE_TEXT_STRING (childii);
unsigned char charsets[NUM_LEADING_BYTES];
- struct face_cachel *cachel = WINDOW_FACE_CACHEL (w, findex);
+ struct face_cachel *cachel
+ = WINDOW_FACE_CACHEL (w, findex);
+
+ DISPLAY_LINE_INIT (dl);
find_charsets_in_ibyte_string (charsets,
XSTRING_DATA (string),
@@ -1559,24 +1565,26 @@
ensure_face_cachel_complete (cachel, window, charsets);
convert_ibyte_string_into_ichar_dynarr
- (XSTRING_DATA (string), XSTRING_LENGTH (string), buf);
+ (XSTRING_DATA (string), XSTRING_LENGTH (string),
+ buf);
redisplay_normalize_display_box (&cdb, &cdga);
/* Offsets are now +ve again so be careful
when fixing up the display line. */
- xzero (dl);
/* Munge boxes into display lines. */
dl.ypos = (cdb.ypos - cdga.yoffset)
+ glyph_ascent (child, image_instance);
dl.ascent = glyph_ascent (child, image_instance);
dl.descent = glyph_descent (child, image_instance);
dl.top_clip = cdga.yoffset;
- dl.clip = (dl.ypos + dl.descent) - (cdb.ypos + cdb.height);
+ dl.clip = (dl.ypos + dl.descent)
+ - (cdb.ypos + cdb.height);
/* output_string doesn't understand offsets in
the same way as other routines - we have to
add the offset to the width so that we
output the full string. */
- MAYBE_DEVMETH (d, output_string, (w, &dl, buf, cdb.xpos,
+ MAYBE_DEVMETH (d, output_string,
+ (w, &dl, buf, cdb.xpos,
cdga.xoffset, cdb.xpos,
cdga.width + cdga.xoffset,
findex, 0, 0, 0, 0));
--
New @-quartet featured CD Review !!
http://www.indie-music.com/modules.php?name=News&file=article&sid...
Didier Verna, didier(a)lrde.epita.fr,
http://www.lrde.epita.fr/~didier
EPITA / LRDE, 14-16 rue Voltaire Tel.+33 (1) 44 08 01 85
94276 Le Kremlin-Bicêtre, France Fax.+33 (1) 53 14 59 22 didier(a)xemacs.org
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches