9f8aa270084a0d7466a78e48c6c5b29bdedc3a90 — Ne02ptzero 2 years ago 62b8123
FIX: line_t -> char_t

Signed-off-by: Ne02ptzero <louis@ne02ptzero.me>
5 files changed, 33 insertions(+), 14 deletions(-)

M main.c
A run.c
A run.h
M term.c
M term.h
M main.c => main.c +3 -0
@@ 3,6 3,7 @@   #include "x.h"
  #include "term.h"
+ #include "run.h"
  
  void lt_setenv(x_window_t *x)
  {


@@ 23,6 24,8 @@ term_init(&t, 80, 25);
      lt_setenv(&x);
  
+     run(&x, &t);
+ 
      x_window_dtr(&x);
      term_dtr(&t);
      return 0;

A run.c => run.c +7 -0
@@ 0,0 1,7 @@
+ #include "run.h"
+ 
+ void run(x_window_t *x, term_t *term)
+ {
+     (void)x;
+     (void)term;
+ }

A run.h => run.h +9 -0
@@ 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 */

M term.c => term.c +10 -10
@@ 21,8 21,8 @@       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 @@ 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_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_swap_screen(term_t *t)
  {
-     line_t      **tmp = t->line;
+     char_t      **tmp = t->line;
  
      t->line = t->alt;
      t->alt = tmp;

M term.h => term.h +4 -4
@@ 8,10 8,10 @@ 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 @@ 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 */