Mercurial > hg > xemacs-beta
changeset 4207:62d532188a28
[xemacs-hg @ 2007-10-03 10:06:39 by didierv]
Fix some other DEFAULT_INDEX == 0 assumptions
author | didierv |
---|---|
date | Wed, 03 Oct 2007 10:06:42 +0000 |
parents | a3e638b941b0 |
children | e820df1cb11a |
files | src/ChangeLog src/frame.c src/redisplay-output.c src/redisplay.c src/redisplay.h |
diffstat | 5 files changed, 92 insertions(+), 63 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog Tue Oct 02 21:51:44 2007 +0000 +++ b/src/ChangeLog Wed Oct 03 10:06:42 2007 +0000 @@ -1,3 +1,17 @@ +2007-10-03 Didier Verna <didier@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. + 2004-12-08 Shyamal Prasad <shyamal@member.fsf.org> * editfns.c: @@ -5,7 +19,7 @@ Added documentation for %z, %g, %G and %V specifiers. This synchs up the set of % specifiers for format-time-string with Emacs 21.3.1. Make copy of static buffer returned by localtime(). - + * strftime.c: * strftime.c (strftime): Implemented %z, %g, %G and %V in a style similar to existing @@ -25,8 +39,8 @@ * mule-ccl.c: * mule-ccl.c (CCL_CALL_FOR_MAP_INSTRUCTION): * mule-ccl.c (ccl_driver): - Merge Kenichi Handa's 2004-06-12 GNU bugfix, handling EOF in - ccl_driver correctly. + Merge Kenichi Handa's 2004-06-12 GNU bugfix, handling EOF in + ccl_driver correctly. 2007-09-26 Didier Verna <didier@xemacs.org>
--- a/src/frame.c Tue Oct 02 21:51:44 2007 +0000 +++ b/src/frame.c Wed Oct 03 10:06:42 2007 +0000 @@ -180,10 +180,10 @@ { XD_END } }; -DEFINE_LRECORD_IMPLEMENTATION ("expose-ignore", +DEFINE_LRECORD_IMPLEMENTATION ("expose-ignore", expose_ignore, 1, /*dumpable-flag*/ - 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, expose_ignore_description_1, struct expose_ignore); #else /* not NEW_GC */ @@ -239,7 +239,7 @@ { XD_BLOCK_PTR, offsetof (struct frame, framemeths), 1, { &console_methods_description } }, - { XD_UNION, offsetof (struct frame, frame_data), + { XD_UNION, offsetof (struct frame, frame_data), XD_INDIRECT (0, 0), { &frame_data_description } }, { XD_END } }; @@ -285,7 +285,7 @@ DEFINE_LRECORD_IMPLEMENTATION ("frame", frame, 0, /*dumpable-flag*/ - mark_frame, print_frame, 0, 0, 0, + mark_frame, print_frame, 0, 0, 0, frame_description, struct frame); @@ -478,7 +478,7 @@ if (!EQ (lissed, Qunbound)) DEVICE_FRAME_LIST (XDEVICE (XCAR (kawnz))) = lissed; return Qnil; -} +} DEFUN ("make-frame", Fmake_frame, 0, 2, "", /* Create and return a new frame, displaying the current buffer. @@ -532,15 +532,15 @@ in the dumped executable, and we can choose it at runtime. */ name = build_string("XEmacs"); } - else if (NILP (Vdefault_frame_name)) - { + else if (NILP (Vdefault_frame_name)) + { if (egetenv ("USE_EMACS_AS_DEFAULT_APPLICATION_CLASS")) { - Vdefault_frame_name = build_string ("emacs"); + Vdefault_frame_name = build_string ("emacs"); } - else + else { - Vdefault_frame_name = build_string ("XEmacs"); + Vdefault_frame_name = build_string ("XEmacs"); } } @@ -589,7 +589,7 @@ if (initialized && !DEVICE_STREAM_P (d)) { if (!NILP (f->minibuffer_window)) - reset_face_cachels (XWINDOW (f->minibuffer_window)); + reset_face_cachels (XWINDOW (f->minibuffer_window)); reset_face_cachels (XWINDOW (f->root_window)); } @@ -685,10 +685,10 @@ if (!DEVICE_STREAM_P (d)) { /* Now initialise the gutters. This won't change the frame size, - but is needed as input to the layout that change_frame_size - will eventually do. Unfortunately gutter sizing code relies - on the frame in question being visible so we can't do this - earlier. */ + but is needed as input to the layout that change_frame_size + will eventually do. Unfortunately gutter sizing code relies + on the frame in question being visible so we can't do this + earlier. */ init_frame_gutters (f); change_frame_size (f, f->height, f->width, 0); @@ -1330,7 +1330,7 @@ `visible' Consider only frames that are visible. `iconic' Consider only frames that are iconic. `invisible' Consider only frames that are invisible - (this is different from iconic). + (this is different from iconic). `visible-iconic' Consider frames that are visible or iconic. `invisible-iconic' Consider frames that are invisible or iconic. `nomini' Consider all frames except minibuffer-only ones. @@ -1338,9 +1338,9 @@ `iconic-nomini' Like `iconic' but omits minibuffer-only frames. `invisible-nomini' Like `invisible' but omits minibuffer-only frames. `visible-iconic-nomini' Like `visible-iconic' but omits minibuffer-only - frames. + frames. `invisible-iconic-nomini' Like `invisible-iconic' but omits minibuffer-only - frames. + frames. any other value Consider all frames. If WHICH-FRAMES is omitted, `nomini' is used. A value for WHICH-FRAMES @@ -1608,7 +1608,7 @@ /* If this is a popup frame, select its parent if possible. Otherwise, find another visible frame; if none, just take any frame. - First try the same device, then the same console. */ + First try the same device, then the same console. */ next = DEVMETH_OR_GIVEN (d, get_frame_parent, (f), Qnil); if (NILP (next) || EQ (next, frame) || ! FRAME_LIVE_P (XFRAME (next))) @@ -2517,10 +2517,10 @@ frame after it has been created, because the old name was used for resource lookup. */ if (EQ (prop, Qname)) - { - CHECK_STRING (val); - f->name = val; - } + { + CHECK_STRING (val); + f->name = val; + } #endif /* 0 */ if (EQ (prop, Qminibuffer)) store_minibuf_frame_prop (f, val); @@ -2737,14 +2737,14 @@ int height, pheight; frame = wrap_frame (f); - if (!window_system_pixelated_geometry (frame)) + if (!window_system_pixelated_geometry (frame)) { height = FRAME_HEIGHT (f); frame_conversion_internal (f, CHAR_TO_DISPLAYABLE_PIXEL, 0, &pheight, 0, &height, 0); } - else + else pheight = FRAME_PIXHEIGHT (f); return make_int (pheight); @@ -2767,14 +2767,14 @@ int width, pwidth; frame = wrap_frame (f); - if (!window_system_pixelated_geometry (frame)) + if (!window_system_pixelated_geometry (frame)) { width = FRAME_WIDTH (f); frame_conversion_internal (f, CHAR_TO_DISPLAYABLE_PIXEL, &pwidth, 0, &width, 0, 0); } - else + else pwidth = FRAME_PIXWIDTH (f); return make_int (pwidth); @@ -2857,14 +2857,14 @@ frame = wrap_frame (f); CHECK_INT (height); - if (!window_system_pixelated_geometry (frame)) + if (!window_system_pixelated_geometry (frame)) { int h = XINT (height); width = FRAME_WIDTH (f); frame_conversion_internal (f, TOTAL_PIXEL_TO_CHAR, 0, &h, 0, &pheight, 0); } - else + else { width = FRAME_PIXWIDTH (f); pheight = XINT (height); @@ -2887,13 +2887,13 @@ frame = wrap_frame (f); CHECK_INT (height); - if (!window_system_pixelated_geometry (frame)) + if (!window_system_pixelated_geometry (frame)) { int h = XINT (height); width = FRAME_WIDTH (f); frame_conversion_internal (f, DISPLAYABLE_PIXEL_TO_CHAR, 0, &h, 0, &pheight, 0); } - else + else { width = FRAME_PIXWIDTH (f); pheight = XINT (height); @@ -3030,7 +3030,7 @@ CHECK_INT (width); CHECK_INT (height); - if (!window_system_pixelated_geometry (frame)) + if (!window_system_pixelated_geometry (frame)) { int w = XINT (width); int h = XINT (height); @@ -3060,7 +3060,7 @@ CHECK_INT (width); CHECK_INT (height); - if (!window_system_pixelated_geometry (frame)) + if (!window_system_pixelated_geometry (frame)) { int w = XINT (width); int h = XINT (height); @@ -3337,7 +3337,7 @@ if (new_pixheight) { /* Adjust for gutters here so that we always get set - properly. */ + properly. */ new_pixheight -= (FRAME_TOP_GUTTER_BOUNDS (f) + FRAME_BOTTOM_GUTTER_BOUNDS (f)); @@ -3388,7 +3388,7 @@ if (new_pixwidth) { /* Adjust for gutters here so that we always get set - properly. */ + properly. */ new_pixwidth -= (FRAME_LEFT_GUTTER_BOUNDS (f) + FRAME_RIGHT_GUTTER_BOUNDS (f)); @@ -3479,7 +3479,7 @@ Dynarr_reset (db->runes); generate_formatted_string_db (format_str, Qnil, w, dl, db, findex, 0, - -1, type); + -1, type); Dynarr_reset (title_string_ichar_dynarr); while (elt < Dynarr_length (db->runes)) @@ -3605,7 +3605,7 @@ #endif { title_string_ichar_dynarr = Dynarr_new (Ichar); - xzero (title_string_display_line); + DISPLAY_LINE_INIT (title_string_display_line); } }
--- a/src/redisplay-output.c Tue Oct 02 21:51:44 2007 +0000 +++ b/src/redisplay-output.c Wed Oct 03 10:06:42 2007 +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,35 +1554,40 @@ 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), - XSTRING_LENGTH (string)); + XSTRING_DATA (string), + XSTRING_LENGTH (string)); 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, - cdga.xoffset, cdb.xpos, - cdga.width + cdga.xoffset, - findex, 0, 0, 0, 0)); + MAYBE_DEVMETH (d, output_string, + (w, &dl, buf, cdb.xpos, + cdga.xoffset, cdb.xpos, + cdga.width + cdga.xoffset, + findex, 0, 0, 0, 0)); Dynarr_reset (buf); } }
--- a/src/redisplay.c Tue Oct 02 21:51:44 2007 +0000 +++ b/src/redisplay.c Wed Oct 03 10:06:42 2007 +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; }
--- a/src/redisplay.h Tue Oct 02 21:51:44 2007 +0000 +++ b/src/redisplay.h Wed Oct 03 10:06:42 2007 +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) \