[hackers] [st] renamed some structures

From: Anselm R. Garbe <arg_AT_suckless.org>
Date: Fri Mar 02 16:02:19 2007

changeset: 56:6aff8d47690e
user: Anselm R. Garbe <arg_AT_suckless.org>
date: Fri Mar 02 15:58:33 2007 +0100
summary: renamed some structures

diff -r 633afd8fecb3 -r 6aff8d47690e main.c
--- a/main.c Fri Mar 02 15:55:30 2007 +0100
+++ b/main.c Fri Mar 02 15:58:33 2007 +0100
@@ -162,9 +162,9 @@ int screen_cols;
 int screen_cols;
 int curr_row = 1;
 int curr_col = 1;
-text_letter_t text_attrs;
-text_row_t *text_screen;
-text_row_t *saved_screen;
+Glyph text_attrs;
+Row *text_screen;
+Row *saved_screen;
 
 int
 main(int argc, char **argv) {
diff -r 633afd8fecb3 -r 6aff8d47690e st.h
--- a/st.h Fri Mar 02 15:55:30 2007 +0100
+++ b/st.h Fri Mar 02 15:58:33 2007 +0100
@@ -23,8 +23,7 @@
 #define max(a,b) (((a)>(b))?(a):(b))
 #define GET_BG_COLOR(p) (((p.rev)^(p.sel))?(dc.bg[(p).fg]):(dc.bg[(p).bg]))
 
-typedef struct text_letter_t {
-#ifndef BIGENDIAN
+typedef struct Glyph {
         unsigned letter: 8;
         unsigned fg: 3;
         unsigned bg: 3;
@@ -32,21 +31,12 @@ typedef struct text_letter_t {
         unsigned rev: 1;
         unsigned sel: 1;
         int padding: 15;
-#else
- int padding: 15;
- unsigned sel: 1;
- unsigned rev: 1;
- unsigned bold: 1;
- unsigned fg: 3;
- unsigned bg: 3;
- unsigned letter: 8;
-#endif /* BIGENDIAN */
-} text_letter_t;
+} Glyph;
 
-typedef struct text_row_t {
- text_letter_t *line;
+typedef struct Row {
+ Glyph *line;
         int needs_update;
-} text_row_t;
+} Row;
 
 typedef struct {
         unsigned int nfg;
@@ -77,9 +67,9 @@ extern int scroll_region_end ;
 extern int scroll_region_end ;
 extern int scroll_in_region;
 extern DC dc;
-extern text_letter_t text_attrs;
-extern text_row_t *text_screen;
-extern text_row_t *saved_screen;
+extern Glyph text_attrs;
+extern Row *text_screen;
+extern Row *saved_screen;
 extern Display *dpy;
 extern Window win, root;
 extern GC gc;
@@ -104,7 +94,7 @@ extern void redraw_region(int,int,int,in
 extern void redraw_region(int,int,int,int);
 extern void force_redraw_screen(void);
 extern void win_set_window_title(char *);
-extern text_row_t *buffer_create(int rows, int cols);
+extern Row *buffer_create(int rows, int cols);
 
 /* util.c */
 void *emalloc(unsigned int size);
diff -r 633afd8fecb3 -r 6aff8d47690e vt.c
--- a/vt.c Fri Mar 02 15:55:30 2007 +0100
+++ b/vt.c Fri Mar 02 15:58:33 2007 +0100
@@ -86,7 +86,7 @@ region_scroll_down(int start, int end, i
 }
 
 void
-set_text_attrs(text_letter_t l) {
+set_text_attrs(Glyph l) {
         int fg, bg;
 
         if(l.rev ^ l.sel)
@@ -226,14 +226,14 @@ hide_cursor(void) {
         }
         cursor_is_visible = 0;
 }
-text_row_t *
+Row *
 buffer_create(int rows, int cols) {
         int i;
- text_row_t *tr;
-
- tr = emallocz(rows * sizeof(text_row_t));
+ Row *tr;
+
+ tr = emallocz(rows * sizeof(Row));
         for(i = 0; i < rows; i++)
- tr[i].line = emallocz(cols * sizeof(text_letter_t));
+ tr[i].line = emallocz(cols * sizeof(Glyph));
         return tr;
 }
 
@@ -310,7 +310,7 @@ cursor_rego(void) {
 }
 
 void
-delete_rows(text_row_t *screen, int start, int n) {
+delete_rows(Row *screen, int start, int n) {
         int i;
 
         for(i = 0; i < n; i++)
@@ -318,12 +318,12 @@ delete_rows(text_row_t *screen, int star
 }
 
 void
-add_rows(text_row_t *screen, int pos, int n) {
+add_rows(Row *screen, int pos, int n) {
         int i, j;
 
         text_attrs.letter = ' ';
         for(i = 0; i < n; i++) {
- screen[pos + i - 1].line = calloc(screen_cols, sizeof(text_letter_t));
+ screen[pos + i - 1].line = calloc(screen_cols, sizeof(Glyph));
                 assert(screen[pos + i - 1].line);
                 for(j = 0; j < screen_cols; j++)
                         screen[pos + i - 1].line[j] = text_attrs;
@@ -332,7 +332,7 @@ add_rows(text_row_t *screen, int pos, in
 }
 
 void
-buffer_destroy(text_row_t *screen) {
+buffer_destroy(Row *screen) {
         int i;
 
         for(i = 0; i < screen_rows; i++)
@@ -357,14 +357,14 @@ restore_saved_screen(void) {
 }
 
 void
-_buffer_resize(text_row_t **s, int rows, int cols) {
+_buffer_resize(Row **s, int rows, int cols) {
         int i;
 
         if(rows < screen_rows) {
                 delete_rows(*s, 1, screen_rows - rows);
                 moverows(*s, screen_rows - rows + 1, 1, rows);
         }
- *s = realloc(*s, rows * sizeof(text_row_t));
+ *s = realloc(*s, rows * sizeof(Row));
         assert(*s);
         if(rows > screen_rows)
                 add_rows(*s, screen_rows + 1, rows - screen_rows);
@@ -372,7 +372,7 @@ _buffer_resize(text_row_t **s, int rows,
                 for(i = 0; i < rows; i++) {
                         int j;
 
- (*s)[i].line = realloc((*s)[i].line, cols * sizeof(text_letter_t));
+ (*s)[i].line = realloc((*s)[i].line, cols * sizeof(Glyph));
                         assert((*s)[i].line);
                         for(j = screen_cols; j < cols; j++)
                                 *(int*)(&((*s)[i]).line[j]) = 0;
@@ -404,13 +404,13 @@ clear_area(int x1, int y1, int x2, int y
 }
 
 void
-clear_row(text_row_t *r) {
- memset(r->line, '\0', screen_cols * sizeof(text_letter_t));
-}
-
-void
-moverows(text_row_t *screen, int from, int to, int n) {
- memmove(&(screen[to-1]), &(screen[from-1]), n * sizeof(text_row_t));
+clear_row(Row *r) {
+ memset(r->line, '\0', screen_cols * sizeof(Glyph));
+}
+
+void
+moverows(Row *screen, int from, int to, int n) {
+ memmove(&(screen[to-1]), &(screen[from-1]), n * sizeof(Row));
 }
 
 void
Received on Fri Mar 02 2007 - 16:02:19 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:56:05 UTC