aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGerd Moellmann2000-12-21 15:39:58 +0000
committerGerd Moellmann2000-12-21 15:39:58 +0000
commit9ab436b9e087a6656fed986b9099b003785bcb82 (patch)
tree9f5cd9ade9c6c72d9aa1063d425ec92a18043f0a /src
parente797dea65e95544c680a6dd99a0ead7b5989e476 (diff)
downloademacs-9ab436b9e087a6656fed986b9099b003785bcb82.tar.gz
emacs-9ab436b9e087a6656fed986b9099b003785bcb82.zip
(dump_glyph_row, dump_glyph_matrix, Fdump_glyph_matrix)
[GLYPH_DEBUG]: Extended to dump glyphs in short form.
Diffstat (limited to 'src')
-rw-r--r--src/xdisp.c135
1 files changed, 82 insertions, 53 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index 3f8f5d762bf..0410b7194f1 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -11318,31 +11318,36 @@ try_window_id (w)
11318 11318
11319#if GLYPH_DEBUG 11319#if GLYPH_DEBUG
11320 11320
11321 void dump_glyph_row P_ ((struct glyph_matrix *, int, int)); 11321void dump_glyph_row P_ ((struct glyph_matrix *, int, int));
11322static void dump_glyph_matrix P_ ((struct glyph_matrix *, int)); 11322void dump_glyph_matrix P_ ((struct glyph_matrix *, int));
11323 11323
11324 11324
11325/* Dump the contents of glyph matrix MATRIX on stderr. If 11325/* Dump the contents of glyph matrix MATRIX on stderr.
11326 WITH_GLYPHS_P is non-zero, dump glyph contents as well. */
11327 11326
11328static void 11327 GLYPHS 0 means don't show glyph contents.
11329dump_glyph_matrix (matrix, with_glyphs_p) 11328 GLYPHS 1 means show glyphs in short form
11329 GLYPHS > 1 means show glyphs in long form. */
11330
11331void
11332dump_glyph_matrix (matrix, glyphs)
11330 struct glyph_matrix *matrix; 11333 struct glyph_matrix *matrix;
11331 int with_glyphs_p; 11334 int glyphs;
11332{ 11335{
11333 int i; 11336 int i;
11334 for (i = 0; i < matrix->nrows; ++i) 11337 for (i = 0; i < matrix->nrows; ++i)
11335 dump_glyph_row (matrix, i, with_glyphs_p); 11338 dump_glyph_row (matrix, i, glyphs);
11336} 11339}
11337 11340
11338 11341
11339/* Dump the contents of glyph row at VPOS in MATRIX to stderr. 11342/* Dump the contents of glyph row at VPOS in MATRIX to stderr.
11340 WITH_GLYPH_SP non-zero means dump glyph contents, too. */ 11343 GLYPHS 0 means don't show glyph contents.
11344 GLYPHS 1 means show glyphs in short form
11345 GLYPHS > 1 means show glyphs in long form. */
11341 11346
11342void 11347void
11343dump_glyph_row (matrix, vpos, with_glyphs_p) 11348dump_glyph_row (matrix, vpos, glyphs)
11344 struct glyph_matrix *matrix; 11349 struct glyph_matrix *matrix;
11345 int vpos, with_glyphs_p; 11350 int vpos, glyphs;
11346{ 11351{
11347 struct glyph_row *row; 11352 struct glyph_row *row;
11348 11353
@@ -11350,45 +11355,48 @@ dump_glyph_row (matrix, vpos, with_glyphs_p)
11350 return; 11355 return;
11351 11356
11352 row = MATRIX_ROW (matrix, vpos); 11357 row = MATRIX_ROW (matrix, vpos);
11358
11359 if (glyphs != 1)
11360 {
11361 fprintf (stderr, "Row Start End Used oEI><O\\CTZFes X Y W H V A P\n");
11362 fprintf (stderr, "=======================================================================\n");
11353 11363
11354 fprintf (stderr, "Row Start End Used oEI><O\\CTZFes X Y W H V A P\n"); 11364 fprintf (stderr, "%3d %5d %5d %4d %1.1d%1.1d%1.1d%1.1d%1.1d%1.1d\
11355 fprintf (stderr, "=======================================================================\n");
11356
11357 fprintf (stderr, "%3d %5d %5d %4d %1.1d%1.1d%1.1d%1.1d%1.1d%1.1d\
11358%1.1d%1.1d%1.1d%1.1d%1.1d%1.1d%1.1d %4d %4d %4d %4d %4d %4d %4d\n", 11365%1.1d%1.1d%1.1d%1.1d%1.1d%1.1d%1.1d %4d %4d %4d %4d %4d %4d %4d\n",
11359 row - matrix->rows, 11366 row - matrix->rows,
11360 MATRIX_ROW_START_CHARPOS (row), 11367 MATRIX_ROW_START_CHARPOS (row),
11361 MATRIX_ROW_END_CHARPOS (row), 11368 MATRIX_ROW_END_CHARPOS (row),
11362 row->used[TEXT_AREA], 11369 row->used[TEXT_AREA],
11363 row->contains_overlapping_glyphs_p, 11370 row->contains_overlapping_glyphs_p,
11364 row->enabled_p, 11371 row->enabled_p,
11365 row->inverse_p, 11372 row->inverse_p,
11366 row->truncated_on_left_p, 11373 row->truncated_on_left_p,
11367 row->truncated_on_right_p, 11374 row->truncated_on_right_p,
11368 row->overlay_arrow_p, 11375 row->overlay_arrow_p,
11369 row->continued_p, 11376 row->continued_p,
11370 MATRIX_ROW_CONTINUATION_LINE_P (row), 11377 MATRIX_ROW_CONTINUATION_LINE_P (row),
11371 row->displays_text_p, 11378 row->displays_text_p,
11372 row->ends_at_zv_p, 11379 row->ends_at_zv_p,
11373 row->fill_line_p, 11380 row->fill_line_p,
11374 row->ends_in_middle_of_char_p, 11381 row->ends_in_middle_of_char_p,
11375 row->starts_in_middle_of_char_p, 11382 row->starts_in_middle_of_char_p,
11376 row->x, 11383 row->x,
11377 row->y, 11384 row->y,
11378 row->pixel_width, 11385 row->pixel_width,
11379 row->height, 11386 row->height,
11380 row->visible_height, 11387 row->visible_height,
11381 row->ascent, 11388 row->ascent,
11382 row->phys_ascent); 11389 row->phys_ascent);
11383 fprintf (stderr, "%9d %5d\n", row->start.overlay_string_index, 11390 fprintf (stderr, "%9d %5d\n", row->start.overlay_string_index,
11384 row->end.overlay_string_index); 11391 row->end.overlay_string_index);
11385 fprintf (stderr, "%9d %5d\n", 11392 fprintf (stderr, "%9d %5d\n",
11386 CHARPOS (row->start.string_pos), 11393 CHARPOS (row->start.string_pos),
11387 CHARPOS (row->end.string_pos)); 11394 CHARPOS (row->end.string_pos));
11388 fprintf (stderr, "%9d %5d\n", row->start.dpvec_index, 11395 fprintf (stderr, "%9d %5d\n", row->start.dpvec_index,
11389 row->end.dpvec_index); 11396 row->end.dpvec_index);
11390 11397 }
11391 if (with_glyphs_p) 11398
11399 if (glyphs > 1)
11392 { 11400 {
11393 struct glyph *glyph, *glyph_end; 11401 struct glyph *glyph, *glyph_end;
11394 int prev_had_glyphs_p; 11402 int prev_had_glyphs_p;
@@ -11472,16 +11480,36 @@ dump_glyph_row (matrix, vpos, with_glyphs_p)
11472 ++glyph; 11480 ++glyph;
11473 } 11481 }
11474 } 11482 }
11483 else if (glyphs == 1)
11484 {
11485 char *s = (char *) alloca (row->used[TEXT_AREA] + 1);
11486 int i;
11487
11488 for (i = 0; i < row->used[TEXT_AREA]; ++i)
11489 {
11490 struct glyph *glyph = row->glyphs[TEXT_AREA] + i;
11491 if (glyph->type == CHAR_GLYPH
11492 && glyph->u.ch < 0x80
11493 && glyph->u.ch >= ' ')
11494 s[i] = glyph->u.ch;
11495 else
11496 s[i] = '.';
11497 }
11498
11499 s[i] = '\0';
11500 fprintf (stderr, "%3d: (%d) '%s'\n", vpos, row->enabled_p, s);
11501 }
11475} 11502}
11476 11503
11477 11504
11478DEFUN ("dump-glyph-matrix", Fdump_glyph_matrix, 11505DEFUN ("dump-glyph-matrix", Fdump_glyph_matrix,
11479 Sdump_glyph_matrix, 0, 1, "p", 11506 Sdump_glyph_matrix, 0, 1, "p",
11480 "Dump the current matrix of the selected window to stderr.\n\ 11507 "Dump the current matrix of the selected window to stderr.\n\
11481Shows contents of glyph row structures. With non-nil optional\n\ 11508Shows contents of glyph row structures. With non-nil\n\
11482parameter WITH-GLYPHS-P, dump glyphs as well.") 11509parameter GLYPHS, dump glyphs as well. If GLYPHS is 1 show\n\
11483 (with_glyphs_p) 11510glyphs in short form, otherwise show glyphs in long form.")
11484 Lisp_Object with_glyphs_p; 11511 (glyphs)
11512 Lisp_Object glyphs;
11485{ 11513{
11486 struct window *w = XWINDOW (selected_window); 11514 struct window *w = XWINDOW (selected_window);
11487 struct buffer *buffer = XBUFFER (w->buffer); 11515 struct buffer *buffer = XBUFFER (w->buffer);
@@ -11491,7 +11519,8 @@ parameter WITH-GLYPHS-P, dump glyphs as well.")
11491 fprintf (stderr, "Cursor x = %d, y = %d, hpos = %d, vpos = %d\n", 11519 fprintf (stderr, "Cursor x = %d, y = %d, hpos = %d, vpos = %d\n",
11492 w->cursor.x, w->cursor.y, w->cursor.hpos, w->cursor.vpos); 11520 w->cursor.x, w->cursor.y, w->cursor.hpos, w->cursor.vpos);
11493 fprintf (stderr, "=============================================\n"); 11521 fprintf (stderr, "=============================================\n");
11494 dump_glyph_matrix (w->current_matrix, !NILP (with_glyphs_p)); 11522 dump_glyph_matrix (w->current_matrix,
11523 NILP (glyphs) ? 0 : XINT (glyphs));
11495 return Qnil; 11524 return Qnil;
11496} 11525}
11497 11526