/*
* $Log$
+ * Revision 1.28 2008/02/22 17:07:00 james
+ * *** empty log message ***
+ *
+ * Revision 1.27 2008/02/20 22:54:22 staffcvs
+ * *** empty log message ***
+ *
+ * Revision 1.26 2008/02/20 20:16:07 james
+ * *** empty log message ***
+ *
+ * Revision 1.25 2008/02/20 19:44:37 james
+ * @@
+ *
+ * Revision 1.24 2008/02/20 19:36:06 james
+ * @@
+ *
+ * Revision 1.23 2008/02/20 19:25:09 james
+ * *** empty log message ***
+ *
* Revision 1.22 2008/02/15 03:32:07 james
* *** empty log message ***
*
#include "project.h"
-void
+static void
ansi_move (ANSI * a, CRT_Pos p)
{
char buf[16];
}
-void
+static void
ansi_showhide_cursor (ANSI * a, int hide)
{
if (a->hide_cursor == hide)
}
-void
+static void
ansi_force_attr_normal (ANSI * a)
{
a->terminal->xmit (a->terminal, "\033[0m", 4);
a->color = ANSI_INVAL;
}
-void
+static void
ansi_set_color (ANSI * a, int color)
{
int dif;
}
}
-void
+static void
ansi_set_attr (ANSI * a, int attr)
{
int dif;
}
-void
+static void
ansi_render (ANSI * a, CRT_CA ca)
{
int dif;
}
-void
+static void
ansi_cls (ANSI * a)
{
CRT_Pos p = { 0 };
}
-void
+static void
ansi_spot_scroll_up (ANSI * a, CRT * c)
{
int l, n, p;
}
-void
+static void
ansi_spot_scroll (ANSI * a, CRT * c)
{
#endif
-void
+static void
ansi_draw_line (ANSI * a, CRT_CA * cap, int y)
{
CRT_Pos p = { 0, y };
}
}
-void
+static void
ansi_resize_check (ANSI * a)
{
#define HISTORY_GUESS_SCROLL 24 /*guess all 24 lines usually scroll */
/*if they haven't then ansi_draw will patch it up*/
-void
+static void
ansi_history (ANSI * a, History * h)
{
char buf[32];
/*Roll HISTORY_GUESS_SCROLL lines up putting the top line into the xterm's history */
+ /*Make extra lines a predictable colour*/
+ ansi_set_color (a, CRT_COLOR_NORMAL);
+
ansi_showhide_cursor (a, 1);
i = sprintf (buf, "\033[%d;%dH", HISTORY_GUESS_SCROLL, 1);
a->terminal->xmit (a->terminal, buf, i);
/* erase new line */
s.y = e.y;
e.x = CRT_COLS - 1;
- crt_erase (&a->crt, s, e, 1);
+ crt_erase (&a->crt, s, e, 1,CRT_COLOR_NORMAL);
}
}
-void
+static void
ansi_draw (ANSI * a, CRT * c)
{
CRT_Pos p;
ansi_showhide_cursor (a, a->crt.hide_cursor);
}
-void
+static void
ansi_reset (ANSI * a, CRT * c)
{
a->size.x = -1;
ansi_draw (a, c ? c : &a->crt);
}
-void
+static void
ansi_terminal_reset (ANSI * a)
{
CRT_Pos p = { 0, CRT_ROWS };
ansi_move (a, p);
}
-void
+static void
ansi_flush_escape (ANSI * a, Context * c)
{
ANSI_Parser *p = &a->parser;
p->in_escape = 0;
}
-void
+static void
ansi_parse_deckey (ANSI * a, Context * c)
{
ANSI_Parser *p = &a->parser;
p->escape_ptr = 0;
}
-void
+static void
ansi_parse_ansikey (ANSI * a, Context * c)
{
ANSI_Parser *p = &a->parser;
-void
+static void
ansi_parse_escape (ANSI * a, Context * c)
{
ANSI_Parser *p = &a->parser;
}
-void
+static void
ansi_check_escape (ANSI * a, Context * c)
{
ANSI_Parser *p = &a->parser;
}
-void
+static void
ansi_parse_char (ANSI * a, Context * c, int ch)
{
ANSI_Parser *p = &a->parser;
}
-void
+static void
ansi_parse (ANSI * a, Context * c, char *buf, int len)
{
while (len--)
if (!a->terminal)
- return;
+ return 0;
red = a->terminal->recv (a->terminal, buf, sizeof (buf));
if (red <= 0)
}
-void
+static void
ansi_update (ANSI * a, Context * c)
{
ansi_history (a, c->h);
ansi_draw (a, &c->v->crt);
}
+
+static void
+ansi_free (ANSI * a)
+{
+ a->terminal_reset (a);
+ if (a->terminal)
+ a->terminal->close (a->terminal);
+
+ free (a);
+
+}
+
+ANSI *
+ansi_new_from_terminal (TTY * t)
+{
+ ANSI *ret;
+
+ ret = malloc (sizeof (ANSI));
+ memset (ret, 0, sizeof (ANSI));
+
+ ret->terminal = t;
+
+ ret->update = ansi_update;
+ ret->reset = ansi_reset;
+ ret->terminal_reset = ansi_terminal_reset;
+ ret->close = ansi_free;
+ ret->dispatch = ansi_dispatch;
+
+ return ret;
+}