[hackers] [st] renamed some functions (unordered now)

From: Anselm R. Garbe <arg_AT_suckless.org>
Date: Thu Mar 22 14:52:55 2007

changeset: 69:2810bce547d0
user: Anselm R. Garbe <arg_AT_suckless.org>
date: Wed Mar 21 12:57:07 2007 +0100
summary: renamed some functions (unordered now)

diff -r ba133c735cd9 -r 2810bce547d0 event.c
--- a/event.c Wed Mar 21 12:06:53 2007 +0100
+++ b/event.c Wed Mar 21 12:57:07 2007 +0100
@@ -29,7 +29,7 @@ int using_alternate_screen = 0;
 #define Atom32 CARD32
 
 static int refresh_type = 0;
-static int selection_start_col, selection_start_row, selection_end_col, selection_end_row;
+static int selectionstart_col, selectionstart_row, selection_end_col, selection_end_row;
 static int selection_mode = 0;
 static unsigned char *selection_text = NULL;
 
@@ -39,17 +39,17 @@ static unsigned char *selection_text = N
 #define SELECT_LINE 3
 
 static void
-selection_paste(Time tm) {
+selectionpaste(Time tm) {
         int nbytes;
         char *text;
 
         XConvertSelection(dpy, XA_PRIMARY, XA_CUT_BUFFER0, None, win, tm);
         text = XFetchBytes(dpy, &nbytes);
- cmd_write(text, nbytes);
-}
-
-static void
-selection_reset(void) {
+ writecmd(text, nbytes);
+}
+
+static void
+selectionreset(void) {
         int i, j;
 
         selection_mode = SELECT_NONE;
@@ -65,7 +65,7 @@ selection_reset(void) {
 }
 
 static void
-selection_select_line(int row, int col, Time tm) {
+selectline(int row, int col, Time tm) {
         int i;
 
         if(selection_text)
@@ -84,7 +84,7 @@ selection_select_line(int row, int col,
 }
 
 static void
-selection_select_word(int row, int col, Time tm) {
+selectword(int row, int col, Time tm) {
         int i, len;
 
         if(selection_text)
@@ -109,9 +109,9 @@ selection_select_word(int row, int col,
 }
 
 static void
-selection_start(int row, int col, Time tm) {
+selectionstart(int row, int col, Time tm) {
         fprintf(stderr, "Selection started, row=%d, col=%d\n", row, col);
- selection_start_col = col, selection_start_row = row;
+ selectionstart_col = col, selectionstart_row = row;
         selection_end_col = col, selection_end_row = row;
         selection_mode = SELECT_LETTER;
 }
@@ -141,21 +141,21 @@ buttonpress(XEvent *xev) {
                 switch(times_clicked) {
                 case SELECT_NONE:
                 case SELECT_LETTER:
- selection_reset();
- selection_start(click_row, click_col, xev->xbutton.time);
+ selectionreset();
+ selectionstart(click_row, click_col, xev->xbutton.time);
                         times_clicked = 1;
                         break;
                 case SELECT_WORD:
- selection_select_word(click_row, click_col, xev->xbutton.time);
+ selectword(click_row, click_col, xev->xbutton.time);
                         break;
                 case SELECT_LINE:
- selection_select_line(click_row, click_col, xev->xbutton.time);
+ selectline(click_row, click_col, xev->xbutton.time);
                         break;
                 }
                 lastclick_time = xev->xbutton.time;
                 break;
         case 2: /* middle button */
- selection_paste(xev->xbutton.time);
+ selectionpaste(xev->xbutton.time);
                 break;
         case 3: /* right button */
                 break;
@@ -169,7 +169,7 @@ configurenotify(XEvent *xev) {
         new_cols = xev->xconfigure.width / dc.font.width;
         new_rows = xev->xconfigure.height / dc.font.height;
         if(new_cols != screen_cols || new_rows != screen_rows) {
- buffer_resize(new_rows, new_cols);
+ remallocbuf(new_rows, new_cols);
                 screen_cols = new_cols;
                 screen_rows = new_rows;
                 scroll_region_start = 1;
@@ -177,11 +177,11 @@ configurenotify(XEvent *xev) {
                 ww = xev->xconfigure.width;
                 wh = xev->xconfigure.height;
                 /* make sure the cursor is within the window */
- cursor_rego();
+ movecursor();
                 /* Finally: pass the info to the application */
- resize_app();
+ resizeapp();
                 /* and redraw */
- force_redraw_screen();
+ redrawscreenf();
         }
 }
 
@@ -200,8 +200,8 @@ keypress(XEvent *xev) {
         if(len > 0) {
                 kbuf[KEYSEQLEN-1] = 0;
                 if(meta && len == 1)
- cmd_write("\033", 1);
- cmd_write(kbuf, len);
+ writecmd("\033", 1);
+ writecmd(kbuf, len);
                 return;
         }
         if(keysym >= XK_Shift_L && keysym <= XK_Hyper_R)
@@ -221,26 +221,26 @@ keypress(XEvent *xev) {
                 else
                         kbuf[1] = '[';
                 kbuf[2] = "DACB"[keysym - XK_Left];
- cmd_write(kbuf, 3);
+ writecmd(kbuf, 3);
                 break;
         case XK_Delete:
- cmd_write(DELETE_KEY, sizeof(DELETE_KEY)-1);
+ writecmd(DELETE_KEY, sizeof(DELETE_KEY)-1);
                 break;
         case XK_Home:
- cmd_write(HOME_KEY, sizeof(HOME_KEY)-1);
+ writecmd(HOME_KEY, sizeof(HOME_KEY)-1);
                 break;
         case XK_End:
- cmd_write(END_KEY, sizeof(END_KEY)-1);
+ writecmd(END_KEY, sizeof(END_KEY)-1);
                 break;
         case XK_Prior:
- cmd_write(PREV_KEY, sizeof(PREV_KEY)-1);
+ writecmd(PREV_KEY, sizeof(PREV_KEY)-1);
                 break;
         case XK_Next:
- cmd_write(NEXT_KEY, sizeof(NEXT_KEY)-1);
+ writecmd(NEXT_KEY, sizeof(NEXT_KEY)-1);
                 break;
         case XK_Insert:
                 if(shift)
- selection_paste(CurrentTime);
+ selectionpaste(CurrentTime);
                 break;
         }
 }
@@ -250,7 +250,7 @@ expose(XEvent *xev) {
         int a,b,c,d;
         switch(refresh_type) {
         case REFRESH_FULL:
- force_redraw_screen();
+ redrawscreenf();
                 break;
         case REFRESH_PARTIALLY:
                 a = xev->xexpose.x / dc.font.width + 1;
@@ -261,7 +261,7 @@ expose(XEvent *xev) {
                 b = b > screen_rows ? screen_rows : b;
                 c = c > screen_cols ? screen_cols : c;
                 d = d > screen_rows ? screen_rows : d;
- redraw_region(a,b,c,d);
+ redrawregion(a,b,c,d);
                 break;
         }
 }
@@ -279,7 +279,7 @@ motionnotify(XEvent *xev) {
 
 static void
 selectionclear(XEvent *xev) {
- selection_reset();
+ selectionreset();
         free(selection_text);
         selection_text = NULL;
 }
diff -r ba133c735cd9 -r 2810bce547d0 main.c
--- a/main.c Wed Mar 21 12:06:53 2007 +0100
+++ b/main.c Wed Mar 21 12:57:07 2007 +0100
@@ -117,7 +117,7 @@ initwin(void) {
         XSelectInput(dpy, win, StructureNotifyMask);
         XMapWindow(dpy, win);
         /* Wait for the window to be mapped */
- wait_for_specific_event(MapNotify);
+ waitforevent(MapNotify);
         dc.gc = XCreateGC(dpy, win, 0, NULL);
         XSetForeground(dpy, dc.gc, dc.fg[0]);
         XSetBackground(dpy, dc.gc, dc.bg[0]);
@@ -177,25 +177,25 @@ main(int argc, char **argv) {
         initcolors();
         initfont(DEFAULT_FONT);
         initwin();
- text_screen = buffer_create(screen_rows, screen_cols);
+ text_screen = mallocbuf(screen_rows, screen_cols);
         curr_col = curr_row = 1;
         scroll_region_start = 1;
         scroll_region_end = screen_rows;
 
- set_buffer_fg_color(7);
- set_buffer_bg_color(0);
- set_buffer_attrs(0);
+ setfg(7);
+ setbg(0);
+ setattrs(0);
         XSelectInput(dpy, win, KeyPressMask | ButtonPressMask
                 | FocusChangeMask | VisibilityChangeMask
                 | StructureNotifyMask | ExposureMask
                 | Button1MotionMask | Button3MotionMask);
- execute_command(argc, argv);
+ execcmd(argc, argv);
         for(;;)
                 switch((c = cmdgetc())) {
                 default:
- wrap_line();
+ wrapline();
                         if(c >= ' ') {
- write_buffer(c);
+ insert(c);
                                 curr_col++;
                         }
                         break;
@@ -214,14 +214,14 @@ main(int argc, char **argv) {
                                 if(!wraparound_mode)
                                         curr_row++;
                                 if(curr_row > scroll_region_end) {
- scroll_up(curr_row - scroll_region_end);
+ scrollup(curr_row - scroll_region_end);
                                         curr_row = scroll_region_end;
                                 }
                         }
                         break;
                 case '\033': /* escape */
                         /* handle esc codes */
- dispatch_escape();
+ parseesc();
                         break;
                 case '\n': /* newline */
                         if(!application_keypad_mode)
@@ -229,7 +229,7 @@ main(int argc, char **argv) {
                                 curr_col = 1;
                         curr_row++;
                         if(curr_row > scroll_region_end) {
- scroll_up(curr_row - scroll_region_end);
+ scrollup(curr_row - scroll_region_end);
                                 curr_row = scroll_region_end;
                         }
                         break;
diff -r ba133c735cd9 -r 2810bce547d0 process.c
--- a/process.c Wed Mar 21 12:06:53 2007 +0100
+++ b/process.c Wed Mar 21 12:57:07 2007 +0100
@@ -34,10 +34,10 @@ char *ptydev, *ttydev;
 char *ptydev, *ttydev;
 
 static void
-fill_buffer(int fd) {
+updatebuffer(int fd) {
         int len;
 
- wait_for_input();
+ waitforinput();
         len = read(fd, &output_buf[0], sizeof(output_buf));
         if(len < 0) {
                 fprintf(stderr, "Error reading from command: %m\n");
@@ -52,7 +52,7 @@ fill_buffer(int fd) {
 }
 
 static struct passwd *
-find_user(void) {
+getuser(void) {
         uid_t uid;
         struct passwd *pw;
 
@@ -68,7 +68,7 @@ find_user(void) {
 }
 
 static struct winsize *
-get_font_dim() {
+getwinsize() {
         static struct winsize w;
 
         w.ws_row = screen_rows;
@@ -78,7 +78,7 @@ get_font_dim() {
 }
 
 static int
-get_pty(void) {
+getpty(void) {
         extern char *ptsname();
         int fd;
 
@@ -99,7 +99,7 @@ get_pty(void) {
 }
 
 static int
-get_tty(void) {
+gettty(void) {
         int i;
 
         for(i = 0; i < 100 ; i++)
@@ -114,7 +114,7 @@ get_tty(void) {
                 fprintf(stderr, "Couldn't set controlling terminal: %m\n");
                 return -1;
         }
- if(ioctl(cmd_fd, TIOCSWINSZ, get_font_dim()) < 0) {
+ if(ioctl(cmd_fd, TIOCSWINSZ, getwinsize()) < 0) {
                 fprintf(stderr, "Couldn't set window size: %m\n");
                 return -1;
         }
@@ -122,7 +122,7 @@ get_tty(void) {
 }
 
 static void
-sigchld_handler(int a) {
+sigchld(int a) {
         int status = 0;
 
         if(waitpid(pid, &status, 0) < 0) {
@@ -148,7 +148,7 @@ cmdgetc() {
         unsigned char r;
 
         if(startptr >= endptr) /* there is no more data available */
- fill_buffer(cmd_fd);
+ updatebuffer(cmd_fd);
         r = output_buf[startptr];
 #if 0
         /* For debugging purposes :) Produces quite a lot of output. */
@@ -162,7 +162,7 @@ cmdgetc() {
 }
 
 int
-cmd_write(const char *buf, int len) {
+writecmd(const char *buf, int len) {
         if(write(cmd_fd, buf, len) < 0) {
                 fprintf(stderr, "Error writing to process: %m\n");
                 exit(2);
@@ -171,12 +171,12 @@ cmd_write(const char *buf, int len) {
 }
 
 int
-execute_command(int argc, char **argv) {
+execcmd(int argc, char **argv) {
         char **args;
         struct passwd *pw;
 
- pw = find_user();
- if((cmd_fd = get_pty()) < 0)
+ pw = getuser();
+ if((cmd_fd = getpty()) < 0)
                 return -1;
         if((pid = fork()) < 0) {
                 fprintf(stderr, "Couldn't fork: %m\n");
@@ -184,7 +184,7 @@ execute_command(int argc, char **argv) {
         }
         if(!pid) {
                 /* child */
- get_tty();
+ gettty();
                 putenv("TERM=xterm");
                 chdir(pw->pw_dir);
                 args = calloc(3, sizeof(char*));
@@ -199,13 +199,13 @@ execute_command(int argc, char **argv) {
         }
         /* parent */
         close(slave);
- signal(SIGCHLD, sigchld_handler);
- return 0;
-}
-
-int
-resize_app(void) {
- if(ioctl(cmd_fd, TIOCSWINSZ, get_font_dim()) < 0) {
+ signal(SIGCHLD, sigchld);
+ return 0;
+}
+
+int
+resizeapp(void) {
+ if(ioctl(cmd_fd, TIOCSWINSZ, getwinsize()) < 0) {
                 fprintf(stderr, "Couldn't set window size: %m\n");
                 return -1;
         }
@@ -213,7 +213,7 @@ resize_app(void) {
 }
 
 void
-wait_for_input(void) {
+waitforinput(void) {
         fd_set fset;
         struct timeval tv;
         int r;
@@ -222,8 +222,8 @@ wait_for_input(void) {
         XEvent ev;
 
         X_fd = ConnectionNumber(dpy);
- hide_cursor();
- redraw_screen();
+ hidecursor();
+ redrawscreen();
         for(;;) {
                 FD_ZERO(&fset);
                 if(cmd_fd >= 0)
@@ -240,20 +240,20 @@ wait_for_input(void) {
                 if(!r) {
                         /* timeout */
                         if(need_redraw) {
- hide_cursor();
- redraw_screen();
+ hidecursor();
+ redrawscreen();
                                 need_redraw = 0;
                         }
- show_cursor();
+ showcursor();
                         continue;
                 }
                 if(FD_ISSET(cmd_fd, &fset)) {
                         /* Input from the command */
- hide_cursor();
+ hidecursor();
                         return;
                 }
                 if(FD_ISSET(X_fd, &fset)) {
- hide_cursor();
+ hidecursor();
                         while(XPending(dpy)) {
                                 XNextEvent(dpy, &ev);
                                 if(handler[ev.type])
diff -r ba133c735cd9 -r 2810bce547d0 st.h
--- a/st.h Wed Mar 21 12:06:53 2007 +0100
+++ b/st.h Wed Mar 21 12:57:07 2007 +0100
@@ -67,11 +67,11 @@ extern void (*handler[LASTEvent])(XEvent
 extern void (*handler[LASTEvent])(XEvent *);
 
 /* process.c */
-int resize_app(void);
-int execute_command(int argc, char **argv);
-void wait_for_input(void);
+int resizeapp(void);
+int execcmd(int argc, char **argv);
+void waitforinput(void);
 unsigned char cmdgetc(void);
-int cmd_write(const char *, int);
+int writecmd(const char *, int);
 
 /* util.c */
 void *emalloc(unsigned int size);
@@ -80,20 +80,20 @@ char *estrdup(const char *str);
 char *estrdup(const char *str);
 
 /* vt.c */
-void wait_for_specific_event(int event_type);
-void set_text_attrs(Glyph l);
-void redraw_screen(void);
-void force_redraw_screen(void);
-void redraw_region(int x1, int y1, int x2, int y2);
-void show_cursor(void);
-void hide_cursor(void);
-Row *buffer_create(int rows, int cols);
-void cursor_rego(void);
-void buffer_resize(int rows, int cols);
-void scroll_up(int rows);
-void set_buffer_fg_color(int c);
-void set_buffer_bg_color(int c);
-void set_buffer_attrs(int bold);
-void write_buffer(unsigned char c);
-void wrap_line(void);
-void dispatch_escape(void);
+void waitforevent(int event_type);
+void settextattrs(Glyph l);
+void redrawscreen(void);
+void redrawscreenf(void);
+void redrawregion(int x1, int y1, int x2, int y2);
+void showcursor(void);
+void hidecursor(void);
+Row *mallocbuf(int rows, int cols);
+void movecursor(void);
+void remallocbuf(int rows, int cols);
+void scrollup(int rows);
+void setfg(int c);
+void setbg(int c);
+void setattrs(int bold);
+void insert(unsigned char c);
+void wrapline(void);
+void parseesc(void);
diff -r ba133c735cd9 -r 2810bce547d0 vt.c
--- a/vt.c Wed Mar 21 12:06:53 2007 +0100
+++ b/vt.c Wed Mar 21 12:57:07 2007 +0100
@@ -19,25 +19,25 @@ static int saved_cursor_x, saved_cursor_
 static int saved_cursor_x, saved_cursor_y;
 static int cursor_row, cursor_col;
 static int cursor_is_visible = 0;
-static void delete_rows(Row *screen, int start, int n);
+static void delrows(Row *screen, int start, int n);
 static void moverows(Row *screen, int from, int to, int n);
-static void add_rows(Row *screen, int pos, int n);
-static void win_clear_region(int x1, int y1, int x2, int y2, int color);
-static void scroll_down(int rows);
-static void window_scroll_down(int lines);
-
-static void
-_buffer_resize(Row **s, int rows, int cols) {
+static void addrows(Row *screen, int pos, int n);
+static void winclearregion(int x1, int y1, int x2, int y2, int color);
+static void scrolldown(int rows);
+static void winscrolldown(int lines);
+
+static void
+reallocbuf(Row **s, int rows, int cols) {
         int i;
 
         if(rows < screen_rows) {
- delete_rows(*s, 1, screen_rows - rows);
+ delrows(*s, 1, screen_rows - rows);
                 moverows(*s, screen_rows - rows + 1, 1, rows);
         }
         *s = realloc(*s, rows * sizeof(Row));
         assert(*s);
         if(rows > screen_rows)
- add_rows(*s, screen_rows + 1, rows - screen_rows);
+ addrows(*s, screen_rows + 1, rows - screen_rows);
         if(cols != screen_cols) {
                 for(i = 0; i < rows; i++) {
                         int j;
@@ -52,7 +52,7 @@ _buffer_resize(Row **s, int rows, int co
 }
 
 static void
-add_rows(Row *screen, int pos, int n) {
+addrows(Row *screen, int pos, int n) {
         int i, j;
 
         text_attrs.letter = ' ';
@@ -66,7 +66,7 @@ add_rows(Row *screen, int pos, int n) {
 }
 
 static void
-buffer_destroy(Row *screen) {
+freebuf(Row *screen) {
         int i;
 
         for(i = 0; i < screen_rows; i++)
@@ -75,10 +75,10 @@ buffer_destroy(Row *screen) {
 }
 
 static void
-clear_area(int x1, int y1, int x2, int y2) {
+cleararea(int x1, int y1, int x2, int y2) {
         int i, j;
 
- win_clear_region((x1 - 1) * dc.font.width, (y1 - 1) * dc.font.height,
+ winclearregion((x1 - 1) * dc.font.width, (y1 - 1) * dc.font.height,
                         x2 * dc.font.width, y2 * dc.font.height,
                         GET_BG_COLOR(text_attrs));
         for(i = y1; i <= y2; i++)
@@ -89,7 +89,7 @@ clear_area(int x1, int y1, int x2, int y
 }
 
 static void
-cursor_goto(int x, int y) {
+gotoxy(int x, int y) {
         curr_col = x;
         curr_row = y;
         if(curr_col < 1)
@@ -103,7 +103,7 @@ cursor_goto(int x, int y) {
 }
 
 static int
-cursor_move_down(int n) {
+cursordown(int n) {
         curr_row += n;
         if(curr_row > screen_rows)
                 curr_row = screen_rows;
@@ -111,7 +111,7 @@ cursor_move_down(int n) {
 }
 
 static int
-cursor_move_col(int n) {
+cursorcol(int n) {
         curr_col = n;
         if(curr_col < 1)
                 curr_col = 1;
@@ -121,7 +121,7 @@ cursor_move_col(int n) {
 }
 
 static int
-cursor_move_left(int n) {
+cursorleft(int n) {
         curr_col -= n;
         if(curr_col < 1)
                 curr_col = 1;
@@ -129,7 +129,7 @@ cursor_move_left(int n) {
 }
 
 static int
-cursor_move_right(int n) {
+cursorright(int n) {
         curr_col += n;
         if(curr_col > screen_cols)
                 curr_col = screen_cols;
@@ -137,7 +137,7 @@ cursor_move_right(int n) {
 }
 
 static int
-cursor_move_row(int n) {
+cursorrow(int n) {
         curr_row = n;
         if(curr_row < 1)
                 curr_row = 1;
@@ -147,7 +147,7 @@ cursor_move_row(int n) {
 }
 
 static int
-cursor_move_up(int n) {
+cursorup(int n) {
         curr_row -= n;
         if(curr_row < 1)
                 curr_row = 0;
@@ -155,7 +155,7 @@ cursor_move_up(int n) {
 }
 
 static void
-delete_lines(int lines) {
+dellines(int lines) {
         int a,b;
 
         /* Fake region scroll */
@@ -163,13 +163,13 @@ delete_lines(int lines) {
         b = scroll_in_region;
         scroll_region_start = curr_row;
         scroll_in_region = 1;
- scroll_up(lines);
+ scrollup(lines);
         scroll_region_start = a;
         scroll_in_region = b;
 }
 
 static void
-delete_rows(Row *screen, int start, int n) {
+delrows(Row *screen, int start, int n) {
         int i;
 
         for(i = 0; i < n; i++)
@@ -177,7 +177,7 @@ delete_rows(Row *screen, int start, int
 }
 
 static void
-insert_lines(int lines) {
+inslines(int lines) {
         int a,b;
 
         /* Fake region scroll */
@@ -185,7 +185,7 @@ insert_lines(int lines) {
         b = scroll_in_region;
         scroll_region_start = curr_row;
         scroll_in_region = 1;
- scroll_down(lines);
+ scrolldown(lines);
         scroll_region_start = a;
         scroll_in_region = b;
 }
@@ -196,66 +196,66 @@ moverows(Row *screen, int from, int to,
 }
 
 static void
-region_scroll_down(int start, int end, int lines) {
+region_scrolldown(int start, int end, int lines) {
         XCopyArea(dpy, win, win, dc.gc, 0, (start - 1) * dc.font.height, ww, (end - start + 2 - lines) * dc.font.height,
                         0, (start - 1 + lines) * dc.font.height);
- win_clear_region(0, (start - 1) * dc.font.height, ww, (start + lines - 1) * dc.font.height, GET_BG_COLOR(text_attrs));
-}
-
-static void
-region_scroll_up(int start, int end, int lines) {
+ winclearregion(0, (start - 1) * dc.font.height, ww, (start + lines - 1) * dc.font.height, GET_BG_COLOR(text_attrs));
+}
+
+static void
+regionscrollup(int start, int end, int lines) {
         XCopyArea(dpy, win, win, dc.gc, 0, (start - 1 + lines) * dc.font.height, ww, (end - start + 2 - lines) * dc.font.height,
                         0, (start - 1) * dc.font.height);
- win_clear_region(0, (end - lines) * dc.font.height, ww, end * dc.font.height, GET_BG_COLOR(text_attrs));
-}
-
-static void
-restore_saved_screen(void) {
+ winclearregion(0, (end - lines) * dc.font.height, ww, end * dc.font.height, GET_BG_COLOR(text_attrs));
+}
+
+static void
+restorescreen(void) {
         int i;
 
- buffer_destroy(text_screen);
+ freebuf(text_screen);
         text_screen = saved_screen;
         for(i = 0; i < screen_rows; i++)
                 text_screen[i].needs_update = 1;
 }
 
 static void
-save_current_screen(void) {
+savescreen(void) {
         saved_screen = text_screen;
- text_screen = buffer_create(screen_rows, screen_cols);
-}
-
-static void
-scroll_down(int rows) {
+ text_screen = mallocbuf(screen_rows, screen_cols);
+}
+
+static void
+scrolldown(int rows) {
         if(scroll_in_region) {
                 /* Only scroll region */
- region_scroll_down(scroll_region_start, scroll_region_end, rows);
- delete_rows(text_screen, scroll_region_end - rows + 1, rows);
+ region_scrolldown(scroll_region_start, scroll_region_end, rows);
+ delrows(text_screen, scroll_region_end - rows + 1, rows);
                 moverows(text_screen, scroll_region_start, scroll_region_start + rows, scroll_region_end - scroll_region_start - rows + 1);
- add_rows(text_screen, scroll_region_start, rows);
+ addrows(text_screen, scroll_region_start, rows);
         }
         else {
                 /* Scroll entire buffer */
- window_scroll_down(rows);
- delete_rows(text_screen, screen_rows - rows + 1, rows);
+ winscrolldown(rows);
+ delrows(text_screen, screen_rows - rows + 1, rows);
                 moverows(text_screen, 1, rows + 1, screen_rows - rows);
- add_rows(text_screen, 1, rows);
- }
-}
-
-static void
-set_buffer_reverse(int rev) {
+ addrows(text_screen, 1, rows);
+ }
+}
+
+static void
+setreverse(int rev) {
         text_attrs.rev = rev ? 1 : 0;
 }
 
 static void
-win_clear_region(int x1, int y1, int x2, int y2, int color) {
+winclearregion(int x1, int y1, int x2, int y2, int color) {
         XSetBackground(dpy, dc.gc, color);
         XClearArea(dpy, win, x1, y1, x2 - x1, y2 - y1, 0);
 }
 
 static void
-win_draw_string(int row, int col, char *s, int l) {
+drawtext(int row, int col, char *s, int l) {
         if(dc.font.set)
                 XmbDrawImageString(dpy, win, dc.font.set, dc.gc, col * dc.font.width, row * dc.font.height + dc.font.ascent, s, l);
         else
@@ -268,19 +268,19 @@ win_set_window_title(char *title) {
 }
 
 static void
-window_scroll_up(int lines) {
+winscrollup(int lines) {
         XCopyArea(dpy, win, win, dc.gc, 0, lines * dc.font.height, ww, (screen_rows - lines + 1) * dc.font.height, 0, 0);
- win_clear_region(0, (screen_rows - lines) * dc.font.height, ww, screen_rows * dc.font.height, GET_BG_COLOR(text_attrs));
-}
-
-static void
-window_scroll_down(int lines) {
+ winclearregion(0, (screen_rows - lines) * dc.font.height, ww, screen_rows * dc.font.height, GET_BG_COLOR(text_attrs));
+}
+
+static void
+winscrolldown(int lines) {
         XCopyArea(dpy, win, win, dc.gc, 0, 0, ww, (screen_rows - lines + 1) * dc.font.height, 0, lines * dc.font.height);
- win_clear_region(0, 0, ww, (lines) * dc.font.height, GET_BG_COLOR(text_attrs));
-}
-
-static void
-xterm_seq(int op) {
+ winclearregion(0, 0, ww, (lines) * dc.font.height, GET_BG_COLOR(text_attrs));
+}
+
+static void
+xtermseq(int op) {
         unsigned char *buf;
         int len;
         int buflen;
@@ -310,7 +310,7 @@ xterm_seq(int op) {
 /* extern */
 
 Row *
-buffer_create(int rows, int cols) {
+mallocbuf(int rows, int cols) {
         int i;
         Row *tr;
 
@@ -321,19 +321,19 @@ buffer_create(int rows, int cols) {
 }
 
 void
-buffer_resize(int rows, int cols) {
+remallocbuf(int rows, int cols) {
         if(using_alternate_screen)
- _buffer_resize(&saved_screen, rows, cols);
- _buffer_resize(&text_screen, rows, cols);
-}
-
-void
-cursor_rego(void) {
- cursor_goto(curr_col, curr_row);
-}
-
-void
-dispatch_escape(void) {
+ reallocbuf(&saved_screen, rows, cols);
+ reallocbuf(&text_screen, rows, cols);
+}
+
+void
+movecursor(void) {
+ gotoxy(curr_col, curr_row);
+}
+
+void
+parseesc(void) {
         int pos;
         int args[NPAR];
         int narg = 0;
@@ -383,66 +383,66 @@ dispatch_escape(void) {
                         fprintf(stderr, " %c\n", c);
                         break;
                 case 'A':
- cursor_move_up(narg ? args[0] : 1);
+ cursorup(narg ? args[0] : 1);
                         break;
                 case 'B':
- cursor_move_down(narg ? args[0] : 1);
+ cursordown(narg ? args[0] : 1);
                         break;
                 case 'C':
- cursor_move_right(narg ? args[0] : 1);
+ cursorright(narg ? args[0] : 1);
                         break;
                 case 'D':
- cursor_move_left(narg ? args[0] : 1);
+ cursorleft(narg ? args[0] : 1);
                         break;
                 case 'G':
- cursor_move_col(narg ? args[0] : 1);
+ cursorcol(narg ? args[0] : 1);
                         break;
                 case 'H':
- cursor_goto(args[1] ? args[1] : 1, args[0] ? args[0] : 1);
+ gotoxy(args[1] ? args[1] : 1, args[0] ? args[0] : 1);
                         break;
                 case 'J':
                         if(narg) {
                                 if(args[0] == 1) {
                                         /* erase from start to cursor */
- clear_area(1, 1, screen_cols, curr_row);
+ cleararea(1, 1, screen_cols, curr_row);
                                 }
                                 if(args[0] == 2) {
                                         /* erase whole display */
- clear_area(1, 1, screen_cols, screen_rows);
+ cleararea(1, 1, screen_cols, screen_rows);
                                 }
                         }
                         else {
                                 /* erase from cursor to end of display */
- clear_area(1, curr_row, screen_cols, screen_rows);
+ cleararea(1, curr_row, screen_cols, screen_rows);
                         }
                         break;
                 case 'K':
                         if(narg) {
                                 if(args[0] == 1) {
                                         /* erase from start of line to cursor */
- clear_area(1, curr_row, curr_col, curr_row);
+ cleararea(1, curr_row, curr_col, curr_row);
                                 }
                                 if(args[0] == 2) {
                                         /* erase whole line */
- clear_area(1, curr_row, screen_cols, curr_row);
+ cleararea(1, curr_row, screen_cols, curr_row);
                                 }
                         }
                         else {
                                 /* erase from cursor to end of line */
- clear_area(curr_col, curr_row, screen_cols, curr_row);
+ cleararea(curr_col, curr_row, screen_cols, curr_row);
                         }
                         break;
                 case 'L': /* Insert lines */
- insert_lines(narg ? args[0] : 1);
+ inslines(narg ? args[0] : 1);
                         break;
                 case 'M': /* Delete lines */
- delete_lines(narg ? args[0] : 1);
+ dellines(narg ? args[0] : 1);
                         break;
                 case 'd': /* line position absolute */
- cursor_move_row(narg ? args[0] : 1);
+ cursorrow(narg ? args[0] : 1);
                         break;
                 case 'P': /* clear # of characters */
- clear_area(curr_col, curr_row, curr_col + args[0], curr_row);
+ cleararea(curr_col, curr_row, curr_col + args[0], curr_row);
                         break;
                 case 'h': /* set mode */
                         switch(args[0]) {
@@ -472,7 +472,7 @@ dispatch_escape(void) {
                         case 47:
                                 if(questionmark) {
                                         using_alternate_screen = 1;
- save_current_screen();
+ savescreen();
                                 }
                                 break;
                         }
@@ -504,7 +504,7 @@ dispatch_escape(void) {
                                 if(questionmark)
                                 {
                                         using_alternate_screen = 0;
- restore_saved_screen();
+ restorescreen();
                                 }
                                 break;
                         }
@@ -512,30 +512,30 @@ dispatch_escape(void) {
                 case 'm':
                         /* reset attrs */
                         if(!narg) {
- set_buffer_attrs(0);
- set_buffer_fg_color(7);
- set_buffer_reverse(0);
- set_buffer_bg_color(0);
+ setattrs(0);
+ setfg(7);
+ setreverse(0);
+ setbg(0);
                         }
                         for(i = 0; i < narg; i++) {
                                 if(args[i] == 0) {
- set_buffer_attrs(0);
- set_buffer_fg_color(7);
+ setattrs(0);
+ setfg(7);
                                 }
                                 else if(args[i] == 1)
- set_buffer_attrs(1);
+ setattrs(1);
                                 else if(args[i] == 7)
- set_buffer_reverse(1);
+ setreverse(1);
                                 else if(args[i] == 27)
- set_buffer_reverse(0);
+ setreverse(0);
                                 else if(args[i] >= 30 && args[i] <= 37)
- set_buffer_fg_color(args[i] - 30);
+ setfg(args[i] - 30);
                                 else if(args[i] >= 40 && args[i] <= 47)
- set_buffer_bg_color(args[i] - 40);
+ setbg(args[i] - 40);
                                 else if(args[i] == 39)
- set_buffer_fg_color(7);
+ setfg(7);
                                 else if(args[i] == 49)
- set_buffer_bg_color(0);
+ setbg(0);
                                 else
                                         fprintf(stderr, "Unsupported mode %d\n",
                                                         args[i]);
@@ -553,7 +553,7 @@ dispatch_escape(void) {
                                         /* cursor position */
                                         snprintf(buf, sizeof(buf), "\033[%d;%dR",
                                                         curr_row, curr_col);
- cmd_write(buf, strlen(buf));
+ writecmd(buf, strlen(buf));
                                         break;
                                 }
                         }
@@ -589,7 +589,7 @@ dispatch_escape(void) {
                         fprintf(stderr, "Invalid xterm sequence\n");
                         break;
                 }
- xterm_seq(args[0]);
+ xtermseq(args[0]);
                 break;
         case '7': /* save cursor position */
                 saved_cursor_x = curr_col;
@@ -609,57 +609,57 @@ dispatch_escape(void) {
                 curr_row--;
                 if(curr_row < scroll_region_start) {
                         curr_row = scroll_region_start;
- scroll_down(1);
- }
- break;
- }
-}
-
-void
-force_redraw_screen(void) {
+ scrolldown(1);
+ }
+ break;
+ }
+}
+
+void
+redrawscreenf(void) {
         int i;
         for(i = 0; i < screen_rows; i++)
                 text_screen[i].needs_update = 1;
- redraw_screen();
-}
-
-void
-hide_cursor(void) {
+ redrawscreen();
+}
+
+void
+hidecursor(void) {
         if(!cursor_is_visible)
                 return;
         if(cursor_row <= screen_rows && cursor_col <= screen_cols)
         {
- set_text_attrs(text_screen[cursor_row-1].line[cursor_col-1]);
- win_clear_region((cursor_col - 1) * dc.font.width, (cursor_row - 1) * dc.font.height,
+ settextattrs(text_screen[cursor_row-1].line[cursor_col-1]);
+ winclearregion((cursor_col - 1) * dc.font.width, (cursor_row - 1) * dc.font.height,
                                 cursor_col * dc.font.width, cursor_row * dc.font.height,
                                 GET_BG_COLOR(text_screen[cursor_row-1].line[cursor_col-1]));
- win_draw_string(cursor_row - 1, cursor_col - 1, (char *)&(text_screen[cursor_row - 1].line[cursor_col - 1]), 1);
+ drawtext(cursor_row - 1, cursor_col - 1, (char *)&(text_screen[cursor_row - 1].line[cursor_col - 1]), 1);
                 XFlush(dpy);
         }
         cursor_is_visible = 0;
 }
 
 void
-redraw_region(int x1, int y1, int x2, int y2) {
+redrawregion(int x1, int y1, int x2, int y2) {
         int i, j;
         int a;
         int sl, start;
         unsigned char buf[MAXRUNLENGTH];
 
         a = (*(int*)&(text_screen[y1-1].line[x1-1])) & ~0xff;
- set_text_attrs(text_screen[y1-1].line[x1-1]);
+ settextattrs(text_screen[y1-1].line[x1-1]);
         for(i = y1 - 1; i < y2; i++) {
                 sl = 0; start = x1 - 1;
                 for(j = x1 - 1; j <= x2; j++) {
                         if(j == x2) {
                                 if(sl > 0)
- win_draw_string(i, start, (char *)buf, sl);
+ drawtext(i, start, (char *)buf, sl);
                                 break;
                         }
                         if(a != ((*(int*)&(text_screen[i].line[j])) & ~0xff) || sl >= sizeof(buf)) {
                                 if(sl > 0)
- win_draw_string(i, start, (char *)buf, sl);
- set_text_attrs(text_screen[i].line[j]);
+ drawtext(i, start, (char *)buf, sl);
+ settextattrs(text_screen[i].line[j]);
                                 a = (*(int*)&(text_screen[i].line[j])) & ~0xff;
                                 start = j;
                                 sl = 0;
@@ -673,14 +673,14 @@ redraw_region(int x1, int y1, int x2, in
 }
 
 void
-redraw_screen(void) {
+redrawscreen(void) {
         int i, j;
         int a;
         int sl, start;
         unsigned char buf[MAXRUNLENGTH];
 
         a = 0;
- set_text_attrs(text_screen[0].line[0]);
+ settextattrs(text_screen[0].line[0]);
         for(i = 0; i < screen_rows; i++) {
                 if(!text_screen[i].needs_update)
                         continue;
@@ -688,13 +688,13 @@ redraw_screen(void) {
                 for(j = 0; j <= screen_cols; j++) {
                         if(j == screen_cols) {
                                 if(sl > 0)
- win_draw_string(i, start, (char *)buf, sl);
+ drawtext(i, start, (char *)buf, sl);
                                 break;
                         }
                         if(a != ((*(int*)&(text_screen[i].line[j])) & ~0xff) || sl >= sizeof(buf)) {
                                 if(sl > 0)
- win_draw_string(i, start, (char *)buf, sl);
- set_text_attrs(text_screen[i].line[j]);
+ drawtext(i, start, (char *)buf, sl);
+ settextattrs(text_screen[i].line[j]);
                                 a = (*(int*)&(text_screen[i].line[j])) & ~0xff;
                                 start = j;
                                 sl = 0;
@@ -708,40 +708,40 @@ redraw_screen(void) {
 }
 
 void
-scroll_up(int rows) {
+scrollup(int rows) {
         if(scroll_in_region) {
                 /* Only scroll region */
- region_scroll_up(scroll_region_start, scroll_region_end, rows);
- delete_rows(text_screen, scroll_region_start, rows);
+ regionscrollup(scroll_region_start, scroll_region_end, rows);
+ delrows(text_screen, scroll_region_start, rows);
                 moverows(text_screen, rows + scroll_region_start, scroll_region_start, scroll_region_end - scroll_region_start - rows + 1);
- add_rows(text_screen, scroll_region_end - rows + 1, rows);
+ addrows(text_screen, scroll_region_end - rows + 1, rows);
         }
         else {
                 /* Scroll entire buffer */
- window_scroll_up(rows);
- delete_rows(text_screen, 1, rows);
+ winscrollup(rows);
+ delrows(text_screen, 1, rows);
                 moverows(text_screen, rows + 1, 1, screen_rows - rows);
- add_rows(text_screen, screen_rows - rows + 1, rows);
- }
-}
-
-void
-set_buffer_attrs(int bold) {
+ addrows(text_screen, screen_rows - rows + 1, rows);
+ }
+}
+
+void
+setattrs(int bold) {
         text_attrs.bold = bold ? 1 : 0;
 }
 
 void
-set_buffer_fg_color(int c) {
+setfg(int c) {
         text_attrs.fg = c;
 }
 
 void
-set_buffer_bg_color(int c) {
+setbg(int c) {
         text_attrs.bg = c;
 }
 
 void
-set_text_attrs(Glyph l) {
+settextattrs(Glyph l) {
         int fg, bg;
 
         if(l.rev ^ l.sel)
@@ -758,7 +758,7 @@ set_text_attrs(Glyph l) {
 }
 
 void
-show_cursor(void) {
+showcursor(void) {
         if(cursor_is_visible)
                 return;
         if(!cursor_visible)
@@ -769,17 +769,17 @@ show_cursor(void) {
                 cursor_col = screen_cols;
         if(!dc.font.set)
                 XSetFont(dpy, dc.gc, dc.font.xfont->fid);
- win_clear_region((cursor_col - 1) * dc.font.width, (cursor_row - 1) * dc.font.height,
+ winclearregion((cursor_col - 1) * dc.font.width, (cursor_row - 1) * dc.font.height,
                         cursor_col * dc.font.width, cursor_row * dc.font.height, dc.fg[0]);
         XSetForeground(dpy, dc.gc, dc.fg[0]);
         XSetBackground(dpy, dc.gc, dc.fg[1]);
- win_draw_string(cursor_row - 1, cursor_col - 1, (char *)&(text_screen[cursor_row - 1].line[cursor_col - 1]), 1);
+ drawtext(cursor_row - 1, cursor_col - 1, (char *)&(text_screen[cursor_row - 1].line[cursor_col - 1]), 1);
         XFlush(dpy);
         cursor_is_visible = 1;
 }
 
 void
-wait_for_specific_event(int event_type) {
+waitforevent(int event_type) {
         XEvent e;
         for(;;) {
                 XNextEvent(dpy, &e);
@@ -789,20 +789,20 @@ wait_for_specific_event(int event_type)
 }
 
 void
-wrap_line(void) {
+wrapline(void) {
         while(curr_col > screen_cols) {
                 curr_col -= screen_cols;
                 if(!wraparound_mode)
                         curr_row++;
                 if(curr_row > scroll_region_end) {
- scroll_up(curr_row - scroll_region_end);
+ scrollup(curr_row - scroll_region_end);
                         curr_row = scroll_region_end;
                 }
         }
 }
 
 void
-write_buffer(unsigned char c) {
+insert(unsigned char c) {
         text_attrs.letter = c;
         text_screen[curr_row-1].line[curr_col-1] = text_attrs;
         text_screen[curr_row-1].needs_update = 1;
Received on Thu Mar 22 2007 - 14:52:55 UTC

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