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);
+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 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);
-int vt102_parse(VT102 *v, char *buf, int len);
+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);
+void vt102_send(VT102 *v, uint8_t key, TTY *tty);
void vt102_reset(VT102 *v);
-int vt102_dispatch(VT102 *v);
-VT102 *vt102_new(TTY *t);
+int vt102_dispatch(VT102 *v, TTY *tty);
+VT102 *vt102_new(void);
void vt102_free(VT102 *v);
/* tty.c */
TTY *tty_new_test(void);
/*
* $Log$
+ * Revision 1.19 2008/02/07 11:27:02 james
+ * *** empty log message ***
+ *
* Revision 1.18 2008/02/07 01:59:25 james
* *** empty log message ***
*
void
-vt102_parse_char (VT102 * v, int c)
+vt102_parse_char (VT102 * v, int c,TTY *tty)
{
VT102_parser *p = &v->parser;
/*EOT*/ case 4:
break;
/*ENQ*/ case 5:
- tty_write (v->tty, "vt102", 5);
+ tty_write (tty, "vt102", 5);
break;
/*ACK*/ case 6:
/*BEL*/ case 7:
vt102_status_line (v, "VT102 foo bar baz I'm the urban spaceman baby");
}
-vt102_parse (VT102 * v, char *buf, int len)
+vt102_parse (VT102 * v, char *buf, int len,TTY *t)
{
while (len--)
- vt102_parse_char (v, *(buf++));
+ vt102_parse_char (v, *(buf++),t);
}
void
-vt102_send (VT102 * v, uint8_t key)
+vt102_send (VT102 * v, uint8_t key,TTY *tty)
{
uint8_t c;
#if 0
#endif
if ((key > 31) && (key < 127))
{
- tty_write (v->tty, &key, 1);
+ tty_write (tty, &key, 1);
return;
}
/*LF*/ case 10:
/*VT*/ case 11:
/*FF*/ case 12:
- tty_write (v->tty, &key, 1);
+ tty_write (tty, &key, 1);
break;
/*CR*/ case 13:
- tty_write (v->tty, &key, 1);
+ tty_write (tty, &key, 1);
if (v->modes[VT102_MODE_NEWLINE_MODE])
{
c = 10;
- tty_write (v->tty, &c, 1);
+ tty_write (tty, &c, 1);
}
break;
/*SO*/ case 14:
/*CAN*/ case 24:
/*EM*/ case 25:
/*SUB*/ case 26:
- tty_write (v->tty, &key, 1);
+ tty_write (tty, &key, 1);
break;
/*ESC*/ case 27:
/*FS*/ case 28:
/*RS*/ case 30:
/*US*/ case 31:
/*DEL*/ case 127:
- tty_write (v->tty, &key, 1);
+ tty_write (tty, &key, 1);
break;
case KEY_UP:
if (v->private_modes[VT102_PRIVATE_MODE_CURSOR_MODE])
{
uint8_t buf[] = { 033, 'O', 'A' + (key - KEY_UP) };
- tty_write (v->tty, &buf, sizeof (buf));
+ tty_write (tty, &buf, sizeof (buf));
}
else
{
uint8_t buf[] = { 033, '[', 'A' + (key - KEY_UP) };
- tty_write (v->tty, &buf, sizeof (buf));
+ tty_write (tty, &buf, sizeof (buf));
}
break;
case KEY_STAR:
if (v->application_keypad_mode)
{
uint8_t buf[] = { 033, 'O', 'a' + (key - KEY_154) };
- tty_write (v->tty, &buf, sizeof (buf));
+ tty_write (tty, &buf, sizeof (buf));
}
else
{
[KEY_9] = '9'
};
- tty_write (v->tty, &kpoff[key], 1);
+ tty_write (tty, &kpoff[key], 1);
}
break;
case KEY_ENTER:
if (v->application_keypad_mode)
{
uint8_t buf[] = { 033, 'O', 'M' };
- tty_write (v->tty, &buf, sizeof (buf));
+ tty_write (tty, &buf, sizeof (buf));
}
else
{
c = 13;
- tty_write (v->tty, &c, 1);
+ tty_write (tty, &c, 1);
if (v->modes[VT102_MODE_NEWLINE_MODE])
{
c = 10;
- tty_write (v->tty, &c, 1);
+ tty_write (tty, &c, 1);
}
}
break;
case KEY_PF4:
{
uint8_t buf[] = { 033, 'O', 'P' + (key - KEY_PF1) };
- tty_write (v->tty, &buf, sizeof (buf));
+ tty_write (tty, &buf, sizeof (buf));
}
break;
case KEY_INSERT:
case KEY_PGDN:
{
uint8_t buf[] = { 033, '[', '0' + (key - KEY_180), '~' };
- tty_write (v->tty, &buf, sizeof (buf));
+ tty_write (tty, &buf, sizeof (buf));
}
break;
}
}
int
-vt102_dispatch (VT102 * v)
+vt102_dispatch (VT102 * v,TTY *tty)
{
char buf[1024];
int red;
- red = tty_read (v->tty, buf, sizeof (buf));
+ red = tty_read (tty, buf, sizeof (buf));
if (red < 0)
return -1;
return 0;
- vt102_parse (v, buf, red);
+ vt102_parse (v, buf, red,tty);
return 0;
}
VT102 *
-vt102_new (TTY * t)
+vt102_new (void)
{
VT102 *v;
vt102_reset (v);
- v->tty = t;
return v;
}