From 989d67ccd7c6a685df7af87868b3477989c064e5 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Sat, 28 Mar 2009 15:43:41 +0000 Subject: [PATCH] struct grid_data -> struct grid. Stage 1 of the Grand Plan To Make UTF-8 Better. --- cmd-list-windows.c | 4 +-- grid-view.c | 28 ++++++++++---------- grid.c | 48 +++++++++++++++++----------------- screen-write.c | 6 ++--- screen.c | 8 +++--- tmux.h | 64 +++++++++++++++++++++++----------------------- 6 files changed, 79 insertions(+), 79 deletions(-) diff --git a/cmd-list-windows.c b/cmd-list-windows.c index d84f93f0..1c268cfa 100644 --- a/cmd-list-windows.c +++ b/cmd-list-windows.c @@ -1,4 +1,4 @@ -/* $Id: cmd-list-windows.c,v 1.30 2009-01-19 18:23:40 nicm Exp $ */ +/* $Id: cmd-list-windows.c,v 1.31 2009-03-28 15:43:41 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -49,7 +49,7 @@ cmd_list_windows_exec(struct cmd *self, struct cmd_ctx *ctx) struct winlink *wl; struct window *w; struct window_pane *wp; - struct grid_data *gd; + struct grid *gd; u_int i; unsigned long long size; const char *name; diff --git a/grid-view.c b/grid-view.c index cce823ea..443adbeb 100644 --- a/grid-view.c +++ b/grid-view.c @@ -1,4 +1,4 @@ -/* $Id: grid-view.c,v 1.6 2009-01-10 01:51:21 nicm Exp $ */ +/* $Id: grid-view.c,v 1.7 2009-03-28 15:43:41 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott @@ -32,14 +32,14 @@ /* Get cell for reading. */ const struct grid_cell * -grid_view_peek_cell(struct grid_data *gd, u_int px, u_int py) +grid_view_peek_cell(struct grid *gd, u_int px, u_int py) { return (grid_peek_cell(gd, grid_view_x(gd, px), grid_view_y(gd, py))); } /* Get cell for writing. */ struct grid_cell * -grid_view_get_cell(struct grid_data *gd, u_int px, u_int py) +grid_view_get_cell(struct grid *gd, u_int px, u_int py) { return (grid_get_cell(gd, grid_view_x(gd, px), grid_view_y(gd, py))); } @@ -47,14 +47,14 @@ grid_view_get_cell(struct grid_data *gd, u_int px, u_int py) /* Set cell. */ void grid_view_set_cell( - struct grid_data *gd, u_int px, u_int py, const struct grid_cell *gc) + struct grid *gd, u_int px, u_int py, const struct grid_cell *gc) { grid_set_cell(gd, grid_view_x(gd, px), grid_view_y(gd, py), gc); } /* Clear area. */ void -grid_view_clear(struct grid_data *gd, u_int px, u_int py, u_int nx, u_int ny) +grid_view_clear(struct grid *gd, u_int px, u_int py, u_int nx, u_int ny) { GRID_DEBUG(gd, "px=%u, py=%u, nx=%u, ny=%u", px, py, nx, ny); @@ -66,7 +66,7 @@ grid_view_clear(struct grid_data *gd, u_int px, u_int py, u_int nx, u_int ny) /* Fill area. */ void -grid_view_fill(struct grid_data *gd, +grid_view_fill(struct grid *gd, const struct grid_cell *gc, u_int px, u_int py, u_int nx, u_int ny) { GRID_DEBUG(gd, "px=%u, py=%u, nx=%u, ny=%u", px, py, nx, ny); @@ -79,7 +79,7 @@ grid_view_fill(struct grid_data *gd, /* Scroll region up. */ void -grid_view_scroll_region_up(struct grid_data *gd, u_int rupper, u_int rlower) +grid_view_scroll_region_up(struct grid *gd, u_int rupper, u_int rlower) { GRID_DEBUG(gd, "rupper=%u, rlower=%u", rupper, rlower); @@ -96,7 +96,7 @@ grid_view_scroll_region_up(struct grid_data *gd, u_int rupper, u_int rlower) /* Scroll region down. */ void -grid_view_scroll_region_down(struct grid_data *gd, u_int rupper, u_int rlower) +grid_view_scroll_region_down(struct grid *gd, u_int rupper, u_int rlower) { GRID_DEBUG(gd, "rupper=%u, rlower=%u", rupper, rlower); @@ -108,7 +108,7 @@ grid_view_scroll_region_down(struct grid_data *gd, u_int rupper, u_int rlower) /* Insert lines. */ void -grid_view_insert_lines(struct grid_data *gd, u_int py, u_int ny) +grid_view_insert_lines(struct grid *gd, u_int py, u_int ny) { u_int sy; @@ -124,7 +124,7 @@ grid_view_insert_lines(struct grid_data *gd, u_int py, u_int ny) /* Insert lines in region. */ void grid_view_insert_lines_region( - struct grid_data *gd, u_int rupper, u_int rlower, u_int py, u_int ny) + struct grid *gd, u_int rupper, u_int rlower, u_int py, u_int ny) { GRID_DEBUG( gd, "rupper=%u, rlower=%u, py=%u, ny=%u", rupper, rlower, py, ny); @@ -138,7 +138,7 @@ grid_view_insert_lines_region( /* Delete lines. */ void -grid_view_delete_lines(struct grid_data *gd, u_int py, u_int ny) +grid_view_delete_lines(struct grid *gd, u_int py, u_int ny) { u_int sy; @@ -154,7 +154,7 @@ grid_view_delete_lines(struct grid_data *gd, u_int py, u_int ny) /* Delete lines inside scroll region. */ void grid_view_delete_lines_region( - struct grid_data *gd, u_int rupper, u_int rlower, u_int py, u_int ny) + struct grid *gd, u_int rupper, u_int rlower, u_int py, u_int ny) { GRID_DEBUG( gd, "rupper=%u, rlower=%u, py=%u, ny=%u", rupper, rlower, py, ny); @@ -168,7 +168,7 @@ grid_view_delete_lines_region( /* Insert characters. */ void -grid_view_insert_cells(struct grid_data *gd, u_int px, u_int py, u_int nx) +grid_view_insert_cells(struct grid *gd, u_int px, u_int py, u_int nx) { u_int sx; @@ -187,7 +187,7 @@ grid_view_insert_cells(struct grid_data *gd, u_int px, u_int py, u_int nx) /* Delete characters. */ void -grid_view_delete_cells(struct grid_data *gd, u_int px, u_int py, u_int nx) +grid_view_delete_cells(struct grid *gd, u_int px, u_int py, u_int nx) { u_int sx; diff --git a/grid.c b/grid.c index 78b0cf44..384e39dc 100644 --- a/grid.c +++ b/grid.c @@ -1,4 +1,4 @@ -/* $Id: grid.c,v 1.9 2009-02-16 18:51:39 nicm Exp $ */ +/* $Id: grid.c,v 1.10 2009-03-28 15:43:41 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott @@ -41,12 +41,12 @@ const struct grid_cell grid_default_cell = { ' ', 0, 0, 8, 8 }; memcpy(&gd->data[py][px], gc, sizeof gd->data[py][px]); \ } while (0) -int grid_check_x(struct grid_data *, u_int); -int grid_check_y(struct grid_data *, u_int); +int grid_check_x(struct grid *, u_int); +int grid_check_y(struct grid *, u_int); #ifdef DEBUG int -grid_check_x(struct grid_data *gd, u_int px) +grid_check_x(struct grid *gd, u_int px) { if ((px) >= (gd)->sx) log_fatalx("x out of range: %u", px); @@ -54,7 +54,7 @@ grid_check_x(struct grid_data *gd, u_int px) } int -grid_check_y(struct grid_data *gd, u_int py) +grid_check_y(struct grid *gd, u_int py) { if ((py) >= (gd)->hsize + (gd)->sy) log_fatalx("y out of range: %u", py); @@ -62,7 +62,7 @@ grid_check_y(struct grid_data *gd, u_int py) } #else int -grid_check_x(struct grid_data *gd, u_int px) +grid_check_x(struct grid *gd, u_int px) { if ((px) >= (gd)->sx) { log_debug("x out of range: %u", px); @@ -72,7 +72,7 @@ grid_check_x(struct grid_data *gd, u_int px) } int -grid_check_y(struct grid_data *gd, u_int py) +grid_check_y(struct grid *gd, u_int py) { if ((py) >= (gd)->hsize + (gd)->sy) { log_debug("y out of range: %u", py); @@ -83,10 +83,10 @@ grid_check_y(struct grid_data *gd, u_int py) #endif /* Create a new grid. */ -struct grid_data * +struct grid * grid_create(u_int sx, u_int sy, u_int hlimit) { - struct grid_data *gd; + struct grid *gd; gd = xmalloc(sizeof *gd); gd->sx = sx; @@ -103,7 +103,7 @@ grid_create(u_int sx, u_int sy, u_int hlimit) /* Destroy grid. */ void -grid_destroy(struct grid_data *gd) +grid_destroy(struct grid *gd) { u_int yy; @@ -121,7 +121,7 @@ grid_destroy(struct grid_data *gd) /* Compare grids. */ int -grid_compare(struct grid_data *ga, struct grid_data *gb) +grid_compare(struct grid *ga, struct grid *gb) { struct grid_cell *gca, *gcb; u_int xx, yy; @@ -145,7 +145,7 @@ grid_compare(struct grid_data *ga, struct grid_data *gb) /* Scroll a line into the history. */ void -grid_scroll_line(struct grid_data *gd) +grid_scroll_line(struct grid *gd) { u_int yy; @@ -173,7 +173,7 @@ grid_scroll_line(struct grid_data *gd) /* Reduce line to fit to cell. */ void -grid_reduce_line(struct grid_data *gd, u_int py, u_int sx) +grid_reduce_line(struct grid *gd, u_int py, u_int sx) { if (sx >= gd->size[py]) return; @@ -184,7 +184,7 @@ grid_reduce_line(struct grid_data *gd, u_int py, u_int sx) /* Expand line to fit to cell. */ void -grid_expand_line(struct grid_data *gd, u_int py, u_int sx) +grid_expand_line(struct grid *gd, u_int py, u_int sx) { u_int xx; @@ -199,7 +199,7 @@ grid_expand_line(struct grid_data *gd, u_int py, u_int sx) /* Get cell for reading. */ const struct grid_cell * -grid_peek_cell(struct grid_data *gd, u_int px, u_int py) +grid_peek_cell(struct grid *gd, u_int px, u_int py) { if (grid_check_x(gd, px) != 0) return (&grid_default_cell); @@ -213,7 +213,7 @@ grid_peek_cell(struct grid_data *gd, u_int px, u_int py) /* Get cell at relative position (for writing). */ struct grid_cell * -grid_get_cell(struct grid_data *gd, u_int px, u_int py) +grid_get_cell(struct grid *gd, u_int px, u_int py) { if (grid_check_x(gd, px) != 0) return (NULL); @@ -227,7 +227,7 @@ grid_get_cell(struct grid_data *gd, u_int px, u_int py) /* Set cell at relative position. */ void grid_set_cell( - struct grid_data *gd, u_int px, u_int py, const struct grid_cell *gc) + struct grid *gd, u_int px, u_int py, const struct grid_cell *gc) { if (grid_check_x(gd, px) != 0) return; @@ -243,7 +243,7 @@ grid_set_cell( * cells. */ void -grid_clear(struct grid_data *gd, u_int px, u_int py, u_int nx, u_int ny) +grid_clear(struct grid *gd, u_int px, u_int py, u_int nx, u_int ny) { u_int xx, yy; @@ -277,7 +277,7 @@ grid_clear(struct grid_data *gd, u_int px, u_int py, u_int nx, u_int ny) /* Fill area. */ void -grid_fill(struct grid_data *gd, +grid_fill(struct grid *gd, const struct grid_cell *gc, u_int px, u_int py, u_int nx, u_int ny) { u_int xx, yy; @@ -306,7 +306,7 @@ grid_fill(struct grid_data *gd, /* Clear lines. This just frees and truncates the lines. */ void -grid_clear_lines(struct grid_data *gd, u_int py, u_int ny) +grid_clear_lines(struct grid *gd, u_int py, u_int ny) { u_int yy; @@ -332,14 +332,14 @@ grid_clear_lines(struct grid_data *gd, u_int py, u_int ny) /* Fill a group of lines. */ void grid_fill_lines( - struct grid_data *gd, const struct grid_cell *gc, u_int py, u_int ny) + struct grid *gd, const struct grid_cell *gc, u_int py, u_int ny) { grid_fill(gd, gc, 0, py, gd->sx, ny); } /* Move a group of lines. */ void -grid_move_lines(struct grid_data *gd, u_int dy, u_int py, u_int ny) +grid_move_lines(struct grid *gd, u_int dy, u_int py, u_int ny) { u_int yy; @@ -378,7 +378,7 @@ grid_move_lines(struct grid_data *gd, u_int dy, u_int py, u_int ny) /* Clear a group of cells. */ void -grid_clear_cells(struct grid_data *gd, u_int px, u_int py, u_int nx) +grid_clear_cells(struct grid *gd, u_int px, u_int py, u_int nx) { u_int xx; @@ -403,7 +403,7 @@ grid_clear_cells(struct grid_data *gd, u_int px, u_int py, u_int nx) /* Move a group of cells. */ void -grid_move_cells(struct grid_data *gd, u_int dx, u_int px, u_int py, u_int nx) +grid_move_cells(struct grid *gd, u_int dx, u_int px, u_int py, u_int nx) { u_int xx; diff --git a/screen-write.c b/screen-write.c index 0d009d7e..1f256031 100644 --- a/screen-write.c +++ b/screen-write.c @@ -1,4 +1,4 @@ -/* $Id: screen-write.c,v 1.37 2009-03-05 20:27:51 nicm Exp $ */ +/* $Id: screen-write.c,v 1.38 2009-03-28 15:43:41 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -75,7 +75,7 @@ screen_write_copy(struct screen_write_ctx *ctx, struct screen *src, u_int px, u_int py, u_int nx, u_int ny) { struct screen *s = ctx->s; - struct grid_data *gd = src->grid; + struct grid *gd = src->grid; const struct grid_cell *gc; u_int xx, yy, cx, cy; @@ -516,7 +516,7 @@ void screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc) { struct screen *s = ctx->s; - struct grid_data *gd = s->grid; + struct grid *gd = s->grid; u_int width, xx; const struct grid_cell *hc; struct grid_cell *ic, tc; diff --git a/screen.c b/screen.c index 9133ca12..7050ed70 100644 --- a/screen.c +++ b/screen.c @@ -1,4 +1,4 @@ -/* $Id: screen.c,v 1.78 2009-01-10 01:51:22 nicm Exp $ */ +/* $Id: screen.c,v 1.79 2009-03-28 15:43:41 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -87,7 +87,7 @@ screen_resize(struct screen *s, u_int sx, u_int sy) void screen_resize_x(struct screen *s, u_int sx) { - struct grid_data *gd = s->grid; + struct grid *gd = s->grid; const struct grid_cell *gc; u_int xx, yy; @@ -128,8 +128,8 @@ screen_resize_x(struct screen *s, u_int sx) void screen_resize_y(struct screen *s, u_int sy) { - struct grid_data *gd = s->grid; - u_int oy, yy, ny; + struct grid *gd = s->grid; + u_int oy, yy, ny; if (sy == 0) fatalx("zero size"); diff --git a/tmux.h b/tmux.h index 7ed6bd93..c15c4f71 100644 --- a/tmux.h +++ b/tmux.h @@ -1,4 +1,4 @@ -/* $Id: tmux.h,v 1.286 2009-03-28 14:08:09 nicm Exp $ */ +/* $Id: tmux.h,v 1.287 2009-03-28 15:43:41 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -492,7 +492,7 @@ struct grid_cell { } __packed; /* Grid data. */ -struct grid_data { +struct grid { u_int sx; u_int sy; @@ -543,7 +543,7 @@ struct screen_sel { struct screen { char *title; - struct grid_data *grid; /* grid data */ + struct grid *grid; /* grid data */ u_int cx; /* cursor x */ u_int cy; /* cursor y */ @@ -1365,44 +1365,44 @@ int attributes_fromstring(const char *); /* grid.c */ extern const struct grid_cell grid_default_cell; -struct grid_data *grid_create(u_int, u_int, u_int); -void grid_destroy(struct grid_data *); -int grid_compare(struct grid_data *, struct grid_data *); -void grid_reduce_line(struct grid_data *, u_int, u_int); -void grid_expand_line(struct grid_data *, u_int, u_int); -void grid_scroll_line(struct grid_data *); -const struct grid_cell *grid_peek_cell(struct grid_data *, u_int, u_int); -struct grid_cell *grid_get_cell(struct grid_data *, u_int, u_int); +struct grid *grid_create(u_int, u_int, u_int); +void grid_destroy(struct grid *); +int grid_compare(struct grid *, struct grid *); +void grid_reduce_line(struct grid *, u_int, u_int); +void grid_expand_line(struct grid *, u_int, u_int); +void grid_scroll_line(struct grid *); +const struct grid_cell *grid_peek_cell(struct grid *, u_int, u_int); +struct grid_cell *grid_get_cell(struct grid *, u_int, u_int); void grid_set_cell( - struct grid_data *, u_int, u_int, const struct grid_cell *); -void grid_clear(struct grid_data *, u_int, u_int, u_int, u_int); -void grid_fill(struct grid_data *, + struct grid *, u_int, u_int, const struct grid_cell *); +void grid_clear(struct grid *, u_int, u_int, u_int, u_int); +void grid_fill(struct grid *, const struct grid_cell *, u_int, u_int, u_int, u_int); void grid_fill_lines( - struct grid_data *, const struct grid_cell *, u_int, u_int); -void grid_clear_lines(struct grid_data *, u_int, u_int); -void grid_move_lines(struct grid_data *, u_int, u_int, u_int); -void grid_clear_cells(struct grid_data *, u_int, u_int, u_int); -void grid_move_cells(struct grid_data *, u_int, u_int, u_int, u_int); + struct grid *, const struct grid_cell *, u_int, u_int); +void grid_clear_lines(struct grid *, u_int, u_int); +void grid_move_lines(struct grid *, u_int, u_int, u_int); +void grid_clear_cells(struct grid *, u_int, u_int, u_int); +void grid_move_cells(struct grid *, u_int, u_int, u_int, u_int); /* grid-view.c */ -const struct grid_cell *grid_view_peek_cell(struct grid_data *, u_int, u_int); -struct grid_cell *grid_view_get_cell(struct grid_data *, u_int, u_int); +const struct grid_cell *grid_view_peek_cell(struct grid *, u_int, u_int); +struct grid_cell *grid_view_get_cell(struct grid *, u_int, u_int); void grid_view_set_cell( - struct grid_data *, u_int, u_int, const struct grid_cell *); -void grid_view_clear(struct grid_data *, u_int, u_int, u_int, u_int); -void grid_view_fill(struct grid_data *, + struct grid *, u_int, u_int, const struct grid_cell *); +void grid_view_clear(struct grid *, u_int, u_int, u_int, u_int); +void grid_view_fill(struct grid *, const struct grid_cell *, u_int, u_int, u_int, u_int); -void grid_view_scroll_region_up(struct grid_data *, u_int, u_int); -void grid_view_scroll_region_down(struct grid_data *, u_int, u_int); -void grid_view_insert_lines(struct grid_data *, u_int, u_int); +void grid_view_scroll_region_up(struct grid *, u_int, u_int); +void grid_view_scroll_region_down(struct grid *, u_int, u_int); +void grid_view_insert_lines(struct grid *, u_int, u_int); void grid_view_insert_lines_region( - struct grid_data *, u_int, u_int, u_int, u_int); -void grid_view_delete_lines(struct grid_data *, u_int, u_int); + struct grid *, u_int, u_int, u_int, u_int); +void grid_view_delete_lines(struct grid *, u_int, u_int); void grid_view_delete_lines_region( - struct grid_data *, u_int, u_int, u_int, u_int); -void grid_view_insert_cells(struct grid_data *, u_int, u_int, u_int); -void grid_view_delete_cells(struct grid_data *, u_int, u_int, u_int); + struct grid *, u_int, u_int, u_int, u_int); +void grid_view_insert_cells(struct grid *, u_int, u_int, u_int); +void grid_view_delete_cells(struct grid *, u_int, u_int, u_int); /* screen-write.c */ void screen_write_start(