char rbuf[BUFSIZ];
char ebuf[BUFSIZ];
int rlen, elen;
+ madtty_handler_t handler;
+ void *data;
};
typedef struct t_row_t {
static void try_interpret_escape_seq(madtty_t *t)
{
char lastchar = t->ebuf[t->elen-1];
-
+ if(!*t->ebuf)
+ return;
+ if(t->handler){
+ switch((*(t->handler))(t, t->ebuf)){
+ case MADTTY_HANDLER_OK:
+ goto cancel;
+ case MADTTY_HANDLER_NOTYET:
+ return;
+ }
+ }
switch (*t->ebuf) {
- case '\0':
- return;
-
case 'M':
interpret_csi_SR(t);
cancel_escape_sequence(t);
bg = COLOR_BLACK;
return COLOR_PAIR((7 - fg) * 8 + bg);
}
+
+void madtty_set_handler(madtty_t *t, madtty_handler_t handler)
+{
+ t->handler = handler;
+}
+
+void madtty_set_data(madtty_t *t, void *data)
+{
+ t->data = data;
+}
+
+void *madtty_get_data(madtty_t *t)
+{
+ return t->data;
+}