lt

simple terminal emulator
Log | Files | Refs | git clone https://git.ne02ptzero.me/git/lt

commit 9f8aa270084a0d7466a78e48c6c5b29bdedc3a90
parent 62b8123d3731585f194d4354a0df67dec7bb3a1b
Author: Ne02ptzero <louis@ne02ptzero.me>
Date:   Thu,  7 Jun 2018 09:06:44 +0200

FIX: line_t -> char_t

Signed-off-by: Ne02ptzero <louis@ne02ptzero.me>

Diffstat:
Mmain.c | 3+++
Arun.c | 7+++++++
Arun.h | 9+++++++++
Mterm.c | 20++++++++++----------
Mterm.h | 8++++----
5 files changed, 33 insertions(+), 14 deletions(-)

diff --git a/main.c b/main.c @@ -3,6 +3,7 @@ #include "x.h" #include "term.h" +#include "run.h" void lt_setenv(x_window_t *x) { @@ -23,6 +24,8 @@ int main(void) term_init(&t, 80, 25); lt_setenv(&x); + run(&x, &t); + x_window_dtr(&x); term_dtr(&t); return 0; diff --git a/run.c b/run.c @@ -0,0 +1,7 @@ +#include "run.h" + +void run(x_window_t *x, term_t *term) +{ + (void)x; + (void)term; +} diff --git a/run.h b/run.h @@ -0,0 +1,9 @@ +#ifndef RUN_H +#define RUN_H + +#include "x.h" +#include "term.h" + +void run(x_window_t *x, term_t *term); + +#endif /* RUN_H */ diff --git a/term.c b/term.c @@ -21,8 +21,8 @@ void term_resize(term_t *t, int col, int row) if (i > 0) { - memmove(t->line, t->line + i, row * sizeof(line_t)); - memmove(t->alt, t->alt + i, row * sizeof(line_t)); + memmove(t->line, t->line + i, row * sizeof(char_t)); + memmove(t->alt, t->alt + i, row * sizeof(char_t)); } for (i += row; i < t->row; i++) @@ -31,21 +31,21 @@ void term_resize(term_t *t, int col, int row) free(t->alt[i]); } - t->line = realloc(t->line, row * sizeof(line_t)); - t->alt = realloc(t->alt, row * sizeof(line_t)); + t->line = realloc(t->line, row * sizeof(char_t)); + t->alt = realloc(t->alt, row * sizeof(char_t)); t->dirty = realloc(t->dirty, row * sizeof(*t->dirty)); t->tabs = realloc(t->tabs, col * sizeof(*t->tabs)); for (i = 0; i < min_row; i++) { - t->line[i] = realloc(t->line[i], col * sizeof(line_t)); - t->alt[i] = realloc(t->line[i], col * sizeof(line_t)); + t->line[i] = realloc(t->line[i], col * sizeof(char_t)); + t->alt[i] = realloc(t->line[i], col * sizeof(char_t)); } for (; i < row; i++) { - t->line[i] = malloc(col * sizeof(line_t)); - t->alt[i] = malloc(col * sizeof(line_t)); + t->line[i] = malloc(col * sizeof(char_t)); + t->alt[i] = malloc(col * sizeof(char_t)); } /* XXX: ^ Safe those allocations */ @@ -145,7 +145,7 @@ void term_move_to(term_t *t, int x, int y) void term_clear_region(term_t *t, int x1, int y1, int x2, int y2) { int tmp; - line_t *gp; + char_t *gp; if (x1 > x2) tmp = x1, x1 = x2, x2 = tmp; @@ -189,7 +189,7 @@ void term_full_dirt(term_t *t) void term_swap_screen(term_t *t) { - line_t **tmp = t->line; + char_t **tmp = t->line; t->line = t->alt; t->alt = tmp; diff --git a/term.h b/term.h @@ -8,10 +8,10 @@ typedef struct { unsigned short mode; /*!< Attribute flags */ uint32_t fg; /*!< Foreground color */ uint32_t bg; /*!< Background color */ -} line_t; +} char_t; typedef struct { - line_t attr; /*!< Current char attributes */ + char_t attr; /*!< Current char attributes */ int x; /*!< X position */ int y; /*!< Y position */ uint8_t state; /*!< Cursor state */ @@ -31,8 +31,8 @@ enum cursor_mouvement { typedef struct { int row; /*!< Number of rows */ int col; /*!< Number of columns */ - line_t **line; /*!< Screen buffer */ - line_t **alt; /*!< Alternate Screen buffer */ + char_t **line; /*!< Screen buffer */ + char_t **alt; /*!< Alternate Screen buffer */ int *dirty; /*!< Dirtyness of lines */ cursor_t c; /*!< Cursor */ int ocx; /*!< Old cursor column */