aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorjames <>2008-02-13 16:59:34 +0000
committerjames <>2008-02-13 16:59:34 +0000
commit4d30d1456ad4052bd5d5bbec8cd7dbaad233c7a5 (patch)
tree8a6d64fa375f577cc34d5ef2b6e330d84013cf36 /src
parente32ce0cfdccf5240ae29ef06a13078ae37ee521a (diff)
downloadsympathy-4d30d1456ad4052bd5d5bbec8cd7dbaad233c7a5.tar.gz
sympathy-4d30d1456ad4052bd5d5bbec8cd7dbaad233c7a5.tar.bz2
sympathy-4d30d1456ad4052bd5d5bbec8cd7dbaad233c7a5.zip
*** empty log message ***
Diffstat (limited to 'src')
-rw-r--r--src/prototypes.h198
-rw-r--r--src/tty.c7
-rw-r--r--src/util.c8
-rw-r--r--src/vt102.c24
4 files changed, 132 insertions, 105 deletions
diff --git a/src/prototypes.h b/src/prototypes.h
index 635f594..df2d7d5 100644
--- a/src/prototypes.h
+++ b/src/prototypes.h
@@ -1,115 +1,115 @@
/* ansi.c */
-void ansi_move (ANSI * a, CRT_Pos p);
-void ansi_showhide_cursor (ANSI * a, int hide);
-void ansi_force_attr_normal (ANSI * a);
-void ansi_set_color (ANSI * a, int color);
-void ansi_set_attr (ANSI * a, int attr);
-void ansi_render (ANSI * a, CRT_CA ca);
-void ansi_cls (ANSI * a);
-void ansi_draw_line (ANSI * a, CRT_CA * cap, int y);
-void ansi_resize_check (ANSI * a);
-void ansi_history (ANSI * a, History * h);
-void ansi_draw (ANSI * a, CRT * c);
-void ansi_reset (ANSI * a, CRT * c);
-void ansi_terminal_reset (ANSI * a);
-void ansi_flush_escape (ANSI * a, Context * c);
-void ansi_parse_deckey (ANSI * a, Context * c);
-void ansi_parse_ansikey (ANSI * a, Context * c);
-void ansi_parse_escape (ANSI * a, Context * c);
-void ansi_check_escape (ANSI * a, Context * c);
-void ansi_parse_char (ANSI * a, Context * c, int ch);
-void ansi_parse (ANSI * a, Context * c, char *buf, int len);
-int ansi_dispatch (ANSI * a, Context * c);
+int terminal_winches;
+void ansi_move(ANSI *a, CRT_Pos p);
+void ansi_showhide_cursor(ANSI *a, int hide);
+void ansi_force_attr_normal(ANSI *a);
+void ansi_set_color(ANSI *a, int color);
+void ansi_set_attr(ANSI *a, int attr);
+void ansi_render(ANSI *a, CRT_CA ca);
+void ansi_cls(ANSI *a);
+void ansi_draw_line(ANSI *a, CRT_CA *cap, int y);
+void ansi_resize_check(ANSI *a);
+void ansi_history(ANSI *a, History *h);
+void ansi_draw(ANSI *a, CRT *c);
+void ansi_reset(ANSI *a, CRT *c);
+void ansi_terminal_reset(ANSI *a);
+void ansi_flush_escape(ANSI *a, Context *c);
+void ansi_parse_deckey(ANSI *a, Context *c);
+void ansi_parse_ansikey(ANSI *a, Context *c);
+void ansi_parse_escape(ANSI *a, Context *c);
+void ansi_check_escape(ANSI *a, Context *c);
+void ansi_parse_char(ANSI *a, Context *c, int ch);
+void ansi_parse(ANSI *a, Context *c, char *buf, int len);
+int ansi_dispatch(ANSI *a, Context *c);
+void ansi_update(ANSI *a, Context *c);
/* crt.c */
-void crt_erase (CRT * c, CRT_Pos s, CRT_Pos e, int ea);
-void crt_cls (CRT * c);
-void crt_scroll_up (CRT * c, CRT_Pos s, CRT_Pos e, int ea);
-void crt_scroll_down (CRT * c, CRT_Pos s, CRT_Pos e, int ea);
-void crt_reset (CRT * c);
-void crt_insert (CRT * c, CRT_CA ca);
+void crt_erase(CRT *c, CRT_Pos s, CRT_Pos e, int ea);
+void crt_cls(CRT *c);
+void crt_scroll_up(CRT *c, CRT_Pos s, CRT_Pos e, int ea);
+void crt_scroll_down(CRT *c, CRT_Pos s, CRT_Pos e, int ea);
+void crt_reset(CRT *c);
+void crt_insert(CRT *c, CRT_CA ca);
/* html.c */
-void html_entity (FILE * f, int c);
-void html_render (FILE * f, CRT_CA c);
-void html_draw (FILE * f, CRT * c);
+void html_entity(FILE *f, int c);
+void html_render(FILE *f, CRT_CA c);
+void html_draw(FILE *f, CRT *c);
/* libsympathy.c */
-void testy (void);
-void ring_test (void);
/* render.c */
/* version.c */
/* vt102.c */
-void vt102_log_line (Context * c, int line);
-void vt102_history (Context * c, CRT_Pos t, CRT_Pos b);
-void vt102_clip_cursor (VT102 * v, CRT_Pos tl, CRT_Pos br);
-void vt102_cursor_normalize (VT102 * v);
-void vt102_cursor_carriage_return (VT102 * v);
-void vt102_cursor_advance_line (Context * c);
-void vt102_cursor_advance (Context * c);
-void vt102_do_pending_wrap (Context * c);
-void vt102_cursor_retard (VT102 * v);
-void vt102_reset_tabs (VT102 * v);
-void vt102_cursor_advance_tab (VT102 * v);
-int vt102_cursor_home (VT102 * v);
-int vt102_cursor_absolute (VT102 * v, int x, int y);
-int vt102_cursor_relative (VT102 * v, int x, int y);
-void vt102_delete_from_line (VT102 * v, CRT_Pos p);
-void vt102_insert_into_line (VT102 * v, CRT_Pos p);
-void vt102_change_mode (VT102 * v, int private, char *ns, int set);
-void vt102_parse_mode_string (VT102 * v, char *buf, int len);
-void vt102_change_attr (VT102 * v, char *na);
-void vt102_parse_attr_string (VT102 * v, char *buf, int len);
-void vt102_save_state (VT102 * v);
-void vt102_restore_state (VT102 * v);
-void vt102_scs (Context * c, int g, int s);
-void vt102_parse_esc (Context * c, int ch);
-void vt102_parse_csi (Context * c, char *buf, int len);
-void vt102_status_line (VT102 * v, char *str);
-void vt102_parse_char (Context * c, int ch);
-int vt102_parse (Context * c, char *buf, int len);
-void vt102_parser_reset (VT102_parser * p);
-void vt102_send (Context * c, uint8_t key);
-void vt102_reset (VT102 * v);
-int vt102_dispatch (Context * c);
-int vt102_dispatch_one (Context * c);
-VT102 *vt102_new (void);
-void vt102_free (VT102 * v);
+void vt102_log_line(Context *c, int line);
+void vt102_history(Context *c, CRT_Pos t, CRT_Pos b);
+void vt102_clip_cursor(VT102 *v, CRT_Pos tl, CRT_Pos br);
+void vt102_cursor_normalize(VT102 *v);
+void vt102_cursor_carriage_return(VT102 *v);
+void vt102_cursor_advance_line(Context *c);
+void vt102_cursor_advance(Context *c);
+void vt102_do_pending_wrap(Context *c);
+void vt102_cursor_retard(VT102 *v);
+void vt102_reset_tabs(VT102 *v);
+void vt102_cursor_advance_tab(VT102 *v);
+int vt102_cursor_home(VT102 *v);
+int vt102_cursor_absolute(VT102 *v, int x, int y);
+int vt102_cursor_relative(VT102 *v, int x, int y);
+void vt102_delete_from_line(VT102 *v, CRT_Pos p);
+void vt102_insert_into_line(VT102 *v, CRT_Pos p);
+void vt102_change_mode(VT102 *v, int private, char *ns, int set);
+void vt102_parse_mode_string(VT102 *v, char *buf, int len);
+void vt102_change_attr(VT102 *v, char *na);
+void vt102_parse_attr_string(VT102 *v, char *buf, int len);
+void vt102_save_state(VT102 *v);
+void vt102_restore_state(VT102 *v);
+void vt102_scs(Context *c, int g, int s);
+void vt102_parse_esc(Context *c, int ch);
+void vt102_parse_csi(Context *c, char *buf, int len);
+void vt102_status_line(VT102 *v, char *str);
+void vt102_parse_char(Context *c, int ch);
+int vt102_parse(Context *c, char *buf, int len);
+void vt102_parser_reset(VT102_parser *p);
+void vt102_send(Context *c, uint8_t key);
+void vt102_reset(VT102 *v);
+int vt102_dispatch(Context *c);
+int vt102_dispatch_one(Context *c);
+VT102 *vt102_new(void);
+void vt102_free(VT102 *v);
/* tty.c */
+void tty_pre_select(TTY *t, fd_set *rfds, fd_set *wfds);
/* history.c */
-History *history_new (int n);
-void history_free (History * h);
-void history_add (History * h, CRT_CA * c);
+History *history_new(int n);
+void history_free(History *h);
+void history_add(History *h, CRT_CA *c);
/* ring.c */
-int ring_read (Ring * r, void *b, int n);
-int ring_write (Ring * r, void *b, int n);
-int ring_space (Ring * r);
-int ring_bytes (Ring * r);
-Ring *ring_new (int n);
+int ring_read(Ring *r, void *b, int n);
+int ring_write(Ring *r, void *b, int n);
+int ring_space(Ring *r);
+int ring_bytes(Ring *r);
+Ring *ring_new(int n);
/* ptty.c */
-TTY *ptty_open (char *path, char *argv[]);
+TTY *ptty_open(char *path, char *argv[]);
/* terminal.c */
-int terminal_winches;
-void terminal_atexit (void);
-void terminal_getsize (TTY * _t);
-void terminal_dispatch (void);
-void terminal_register_handlers (void);
-TTY *terminal_open (int rfd, int wfd);
+void terminal_atexit(void);
+void terminal_getsize(TTY *_t);
+void terminal_dispatch(void);
+void terminal_register_handlers(void);
+TTY *terminal_open(int rfd, int wfd);
/* util.c */
-int wrap_read (int fd, void *buf, int len);
-int wrap_write (int fd, void *buf, int len);
-void set_nonblocking (int fd);
-void set_blocking (int fd);
-void raw_termios (struct termios *termios);
-void default_termios (struct termios *termios);
+int wrap_read(int fd, void *buf, int len);
+int wrap_write(int fd, void *buf, int len);
+void set_nonblocking(int fd);
+void set_blocking(int fd);
+void raw_termios(struct termios *termios);
+void default_termios(struct termios *termios);
/* log.c */
-Log *file_log_new (char *fn);
+Log *file_log_new(char *fn);
/* ipc.c */
-Socket *socket_listen (char *path);
-Socket *socket_accept (Socket * l);
-Socket *socket_connect (char *path);
-void socket_postselect (Socket * s, fd_set * rfds, fd_set * wfds);
-void socket_preselect (Socket * s, fd_set * rfds, fd_set * wfds);
+Socket *socket_listen(char *path);
+Socket *socket_accept(Socket *l);
+Socket *socket_connect(char *path);
+Socket *socket_postselect(Socket *s, fd_set *rfds, fd_set *wfds);
+void socket_preselect(Socket *s, fd_set *rfds, fd_set *wfds);
/* slide.c */
-void slide_free (Slide * s);
-void slide_consume (Slide * s, int n);
-void slide_added (Slide * s, int n);
-Slide *slide_new (int n);
-void slide_expand (Slide * s, int n);
+void slide_free(Slide *s);
+void slide_consume(Slide *s, int n);
+void slide_added(Slide *s, int n);
+Slide *slide_new(int n);
+void slide_expand(Slide *s, int n);
diff --git a/src/tty.c b/src/tty.c
index 72b31a1..ca4936b 100644
--- a/src/tty.c
+++ b/src/tty.c
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
/*
* $Log$
+ * Revision 1.6 2008/02/13 16:59:34 james
+ * *** empty log message ***
+ *
* Revision 1.5 2008/02/13 16:57:29 james
* *** empty log message ***
*
@@ -22,12 +25,12 @@ static char rcsid[] = "$Id$";
*/
-
+#include "project.h"
void
tty_pre_select (TTY * t, fd_set * rfds, fd_set * wfds)
{
- FD_SET (t->rfd, &rfds);
+ FD_SET (t->rfd, rfds);
}
#if 0
diff --git a/src/util.c b/src/util.c
index bd838b9..0a74869 100644
--- a/src/util.c
+++ b/src/util.c
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
/*
* $Log$
+ * Revision 1.3 2008/02/13 16:57:29 james
+ * *** empty log message ***
+ *
* Revision 1.2 2008/02/13 09:12:21 james
* *** empty log message ***
*
@@ -40,11 +43,14 @@ wrap_write (int fd, void *buf, int len)
{
int writ;
+ errno = 0;
+
writ = write (fd, buf, len);
+
if (!writ)
return -1;
- if ((writ < 0) && (errno == -EAGAIN))
+ if ((writ < 0) && (errno == EAGAIN))
writ = 0;
return writ;
diff --git a/src/vt102.c b/src/vt102.c
index a8d4388..df7b6b1 100644
--- a/src/vt102.c
+++ b/src/vt102.c
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
/*
* $Log$
+ * Revision 1.25 2008/02/13 16:57:29 james
+ * *** empty log message ***
+ *
* Revision 1.24 2008/02/13 09:12:21 james
* *** empty log message ***
*
@@ -264,6 +267,18 @@ vt102_log_line (Context * c, int line)
c->l->log (c->l, logbuf);
}
+/*Called for every upward scroll with same args*/
+void
+vt102_history (Context * c, CRT_Pos t, CRT_Pos b)
+{
+/*Only log if it scrolls off the top*/
+ if (t.y)
+ return;
+
+ t.x = 0;
+ history_add (c->h, &(c->v->crt.screen[CRT_ADDR_POS (&t)]));
+}
+
void
vt102_clip_cursor (VT102 * v, CRT_Pos tl, CRT_Pos br)
{
@@ -314,7 +329,9 @@ vt102_cursor_advance_line (Context * c)
(couldscroll))
{
vt102_log_line (c, v->pos.y);
- //FIXME call out to history
+
+ vt102_history (c, v->top_margin, v->bottom_margin);
+
crt_scroll_up (&v->crt, v->top_margin, v->bottom_margin, 1);
return;
}
@@ -776,6 +793,7 @@ vt102_parse_esc (Context * c, int ch)
if (v->pos.y == v->bottom_margin.y)
{
vt102_log_line (c, v->pos.y);
+ vt102_history (c, v->top_margin, v->bottom_margin);
crt_scroll_up (&v->crt, v->top_margin, v->bottom_margin, 1);
}
else
@@ -938,8 +956,8 @@ vt102_parse_csi (Context * c, char *buf, int len)
{
while (narg--)
{
- //FIXME call out to history
- crt_scroll_up (&v->crt, v->pos, v->bottom_margin, 0);
+ vt102_history (c, v->pos, v->bottom_margin);
+ crt_scroll_up (&v->crt, v->pos, v->bottom_margin, 1);
}
}
break;