aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorjames <>2008-02-07 13:26:35 +0000
committerjames <>2008-02-07 13:26:35 +0000
commit478d03921aba70a8d3155381d45c3498a17a9a0f (patch)
tree4c316383078dc56d3113642db0ffe8c3fe2da55f /src
parente453acb29e1198b939e55d379b7f2c81c740f9a6 (diff)
downloadsympathy-478d03921aba70a8d3155381d45c3498a17a9a0f.tar.gz
sympathy-478d03921aba70a8d3155381d45c3498a17a9a0f.tar.bz2
sympathy-478d03921aba70a8d3155381d45c3498a17a9a0f.zip
*** empty log message ***
Diffstat (limited to 'src')
-rw-r--r--src/libsympathy.c5
-rw-r--r--src/prototypes.h138
-rw-r--r--src/vt102.c22
3 files changed, 97 insertions, 68 deletions
diff --git a/src/libsympathy.c b/src/libsympathy.c
index cf70750..ffe8d16 100644
--- a/src/libsympathy.c
+++ b/src/libsympathy.c
@@ -11,6 +11,9 @@ static char rcsid[] =
/*
* $Log$
+ * Revision 1.12 2008/02/07 13:26:35 james
+ * *** empty log message ***
+ *
* Revision 1.11 2008/02/07 13:22:51 james
* *** empty log message ***
*
@@ -129,7 +132,7 @@ testy (void)
if (FD_ISSET (t->fd, &rfd))
{
- if (vt102_dispatch (v, t))
+ if (vt102_dispatch_one (v, t))
break;
}
diff --git a/src/prototypes.h b/src/prototypes.h
index 7ffe3b2..4468fe8 100644
--- a/src/prototypes.h
+++ b/src/prototypes.h
@@ -1,76 +1,80 @@
/* ansi.c */
-int ansi_read (ANSI * a, void *buf, int n);
-void ansi_write (ANSI * a, char *buf, int n);
-void ansi_getsize (ANSI * a);
-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 (ANSI * a, CRT * c);
-void ansi_reset (ANSI * a);
-void ansi_flush_escape (ANSI * a, VT102 * v, TTY * t);
-void ansi_parse_deckey (ANSI * a, VT102 * v, TTY * t);
-void ansi_parse_ansikey (ANSI * a, VT102 * v, TTY * t);
-void ansi_parse_escape (ANSI * a, VT102 * v, TTY * t);
-void ansi_check_escape (ANSI * a, VT102 * v, TTY * t);
-void ansi_parse_char (ANSI * a, int c, VT102 * v, TTY * t);
-void ansi_parse (ANSI * a, char *buf, int len, VT102 * v, TTY * t);
-int ansi_dispatch (ANSI * a, VT102 * v, TTY * t);
+int ansi_read(ANSI *a, void *buf, int n);
+void ansi_write(ANSI *a, char *buf, int n);
+void ansi_getsize(ANSI *a);
+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);
+int ansi_scroll_up(ANSI *a, CRT_Pos s, CRT_Pos e);
+void ansi_spot_scroll_up(ANSI *a, CRT *c);
+void ansi_spot_scroll(ANSI *a, CRT *c);
+void ansi_draw(ANSI *a, CRT *c);
+void ansi_reset(ANSI *a);
+void ansi_flush_escape(ANSI *a, VT102 *v, TTY *t);
+void ansi_parse_deckey(ANSI *a, VT102 *v, TTY *t);
+void ansi_parse_ansikey(ANSI *a, VT102 *v, TTY *t);
+void ansi_parse_escape(ANSI *a, VT102 *v, TTY *t);
+void ansi_check_escape(ANSI *a, VT102 *v, TTY *t);
+void ansi_parse_char(ANSI *a, int c, VT102 *v, TTY *t);
+void ansi_parse(ANSI *a, char *buf, int len, VT102 *v, TTY *t);
+int ansi_dispatch(ANSI *a, VT102 *v, TTY *t);
/* 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 */
struct termios old;
-void testy (void);
+void testy(void);
/* render.c */
/* version.c */
/* vt102.c */
-void vt102_log_line (VT102 * v, int line);
-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 (VT102 * v);
-void vt102_cursor_advance (VT102 * v);
-void vt102_do_pending_wrap (VT102 * v);
-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 (VT102 * c, int g, int s);
-void vt102_parse_esc (VT102 * v, int c);
-void vt102_parse_csi (VT102 * v, char *buf, int len);
-void vt102_status_line (VT102 * v, char *str);
-void vt102_parse_char (VT102 * v, int c, TTY * tty);
-int vt102_parse (VT102 * v, char *buf, int len, TTY * t);
-void vt102_parser_reset (VT102_parser * p);
-void vt102_send (VT102 * v, uint8_t key, TTY * tty);
-void vt102_reset (VT102 * v);
-int vt102_dispatch (VT102 * v, TTY * tty);
-VT102 *vt102_new (void);
-void vt102_free (VT102 * v);
+void vt102_log_line(VT102 *v, int line);
+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(VT102 *v);
+void vt102_cursor_advance(VT102 *v);
+void vt102_do_pending_wrap(VT102 *v);
+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(VT102 *c, int g, int s);
+void vt102_parse_esc(VT102 *v, int c);
+void vt102_parse_csi(VT102 *v, char *buf, int len);
+void vt102_status_line(VT102 *v, char *str);
+void vt102_parse_char(VT102 *v, int c, TTY *tty);
+int vt102_parse(VT102 *v, char *buf, int len, TTY *t);
+void vt102_parser_reset(VT102_parser *p);
+void vt102_send(VT102 *v, uint8_t key, TTY *tty);
+void vt102_reset(VT102 *v);
+int vt102_dispatch(VT102 *v, TTY *tty);
+int vt102_dispatch_one(VT102 *v, TTY *tty);
+VT102 *vt102_new(void);
+void vt102_free(VT102 *v);
/* tty.c */
-TTY *tty_new_test (void);
-int tty_read (TTY * t, void *buf, int len);
-int tty_write (TTY * t, void *buf, int len);
-void tty_free (TTY * t);
+TTY *tty_new_test(void);
+int tty_read(TTY *t, void *buf, int len);
+int tty_write(TTY *t, void *buf, int len);
+void tty_free(TTY *t);
diff --git a/src/vt102.c b/src/vt102.c
index f120d32..f3101bb 100644
--- a/src/vt102.c
+++ b/src/vt102.c
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
/*
* $Log$
+ * Revision 1.23 2008/02/07 13:26:35 james
+ * *** empty log message ***
+ *
* Revision 1.22 2008/02/07 13:22:51 james
* *** empty log message ***
*
@@ -1393,6 +1396,25 @@ vt102_dispatch (VT102 * v, TTY * tty)
return 0;
}
+
+int
+vt102_dispatch_one (VT102 * v, TTY * tty)
+{
+ char buf;
+ int red;
+
+ red = tty_read (tty, &buf, sizeof (buf));
+
+ if (red < 0)
+ return -1;
+ if (!red)
+ return 0;
+
+ vt102_parse_char (v, buf, tty);
+
+ return 0;
+}
+
VT102 *
vt102_new (void)
{