From 9de8271b7ff6749da455c0224c16962c85d971ec Mon Sep 17 00:00:00 2001 From: james <> Date: Thu, 7 Feb 2008 00:44:07 +0000 Subject: *** empty log message *** --- src/keys.h | 23 ++++++++++ src/libsympathy.c | 21 +++++---- src/prototypes.h | 126 ++++++++++++++++++++++++++++-------------------------- src/tty.h | 8 +++- src/vt102.c | 5 ++- 5 files changed, 112 insertions(+), 71 deletions(-) diff --git a/src/keys.h b/src/keys.h index 93b27f9..1e6c062 100644 --- a/src/keys.h +++ b/src/keys.h @@ -1,3 +1,25 @@ +/* + * src/keys.h: + * + * Copyright (c) 2008 James McKenzie , + * All rights reserved. + * + */ + +/* + * $Id$ + */ + +/* + * $Log$ + * Revision 1.4 2008/02/07 00:44:07 james + * *** empty log message *** + * + */ + +#ifndef __KEYS_H__ +#define __KEYS_H__ + #define KEY_UP 128 /*A*/ #define KEY_DOWN 129 /*B*/ #define KEY_RIGHT 130 /*C*/ @@ -61,3 +83,4 @@ #define KEY_188 188 /*8 */ #define KEY_189 189 /*9 */ #define KEY_NUM 190 +#endif /* __KEYS_H__ */ diff --git a/src/libsympathy.c b/src/libsympathy.c index 8f28c17..5ffd04d 100644 --- a/src/libsympathy.c +++ b/src/libsympathy.c @@ -11,6 +11,9 @@ static char rcsid[] = /* * $Log$ + * Revision 1.8 2008/02/07 00:43:27 james + * *** empty log message *** + * * Revision 1.7 2008/02/07 00:39:13 james * *** empty log message *** * @@ -85,8 +88,8 @@ testy (void) ansi_reset (&a); - t=tty_new_test(); - v=vt102_new(t); + t = tty_new_test (); + v = vt102_new (t); FD_ZERO (&rfd); for (;;) @@ -102,12 +105,14 @@ testy (void) { } #endif - if (ansi_dispatch(&a,v)) - break; + if (ansi_dispatch (&a, v)) + break; - if (FD_ISSET (t->fd, &rfd)) { - if (vt102_dispatch (v)) break; - } + if (FD_ISSET (t->fd, &rfd)) + { + if (vt102_dispatch (v)) + break; + } if (had_winch) { @@ -116,7 +121,7 @@ testy (void) ansi_reset (&a); ansi_draw (&a, &v->crt); } - ansi_draw (&a, &v->crt); + ansi_draw (&a, &v->crt); } tcsetattr (0, TCSANOW, &old); printf ("QUAT\n"); diff --git a/src/prototypes.h b/src/prototypes.h index 5bbd01a..9418624 100644 --- a/src/prototypes.h +++ b/src/prototypes.h @@ -1,70 +1,76 @@ /* ansi.c */ -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_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_parse_char(ANSI *a, int c, VT102 *v); -void ansi_parse(ANSI *a, char *buf, int len, VT102 *v); -int ansi_dispatch(ANSI *a, VT102 *v); +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_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); +void ansi_parse_deckey (ANSI * a, VT102 * v); +void ansi_parse_ansikey (ANSI * a, VT102 * v); +void ansi_parse_escape (ANSI * a, VT102 * v); +void ansi_check_escape (ANSI * a, VT102 * v); +void ansi_parse_char (ANSI * a, int c, VT102 * v); +void ansi_parse (ANSI * a, char *buf, int len, VT102 * v); +int ansi_dispatch (ANSI * a, VT102 * v); /* 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 */ /* testtty.c */ -int open_fd_to_bash(void); +int open_fd_to_bash (void); /* 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_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); -int vt102_parse(VT102 *v, char *buf, int len); -void vt102_parser_reset(VT102_parser *p); -void vt102_send(VT102 *v, uint8_t key); -void vt102_reset(VT102 *v); -int vt102_dispatch(VT102 *v); -VT102 *vt102_new(TTY *t); -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_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); +int vt102_parse (VT102 * v, char *buf, int len); +void vt102_parser_reset (VT102_parser * p); +void vt102_send (VT102 * v, uint8_t key); +void vt102_reset (VT102 * v); +int vt102_dispatch (VT102 * v); +VT102 *vt102_new (TTY * t); +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/tty.h b/src/tty.h index 14a791b..1da8339 100644 --- a/src/tty.h +++ b/src/tty.h @@ -12,6 +12,9 @@ /* * $Log$ + * Revision 1.2 2008/02/07 00:43:27 james + * *** empty log message *** + * * Revision 1.1 2008/02/06 20:26:58 james * *** empty log message *** * @@ -20,8 +23,9 @@ #ifndef __TTY_H__ #define __TTY_H__ -typedef struct { - int fd; +typedef struct +{ + int fd; } TTY; #endif /* __TTY_H__ */ diff --git a/src/vt102.c b/src/vt102.c index 25d7187..301e224 100644 --- a/src/vt102.c +++ b/src/vt102.c @@ -10,6 +10,9 @@ static char rcsid[] = "$Id$"; /* * $Log$ + * Revision 1.15 2008/02/07 00:43:27 james + * *** empty log message *** + * * Revision 1.14 2008/02/07 00:40:23 james * *** empty log message *** * @@ -1052,7 +1055,7 @@ vt102_send (VT102 * v, uint8_t key) { uint8_t c; #if 0 - fprintf(stderr,"vts: %d(%c)\n",key,(key>31)?key:' '); + fprintf (stderr, "vts: %d(%c)\n", key, (key > 31) ? key : ' '); #endif if ((key > 31) && (key < 127)) { -- cgit v1.2.3