Add a way to associate custom data with a madtty term.
authorMarc Andre Tanner <mat@brain-dump.org>
Mon, 14 Jan 2008 21:53:33 +0000 (22:53 +0100)
committerPierre Habouzit <madcoder@debian.org>
Sun, 3 Feb 2008 18:08:53 +0000 (19:08 +0100)
Signed-off-by: Marc Andre Tanner <mat@brain-dump.org>
madtty/madtty.c
madtty/madtty.h

index 1718b83..c35959a 100644 (file)
@@ -107,6 +107,7 @@ struct madtty_t {
     char ebuf[BUFSIZ];
     int  rlen, elen;
     madtty_handler_t handler;
     char ebuf[BUFSIZ];
     int  rlen, elen;
     madtty_handler_t handler;
+    void *data;
 };
 
 typedef struct t_row_t {
 };
 
 typedef struct t_row_t {
@@ -1095,3 +1096,13 @@ void madtty_set_handler(madtty_t *t, madtty_handler_t handler)
 {
     t->handler = 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;
+}
index 0a1e451..2859bfe 100644 (file)
@@ -55,6 +55,8 @@ typedef int (*madtty_handler_t)(madtty_t *, char *es);
 void madtty_init_colors(void);
 void madtty_init_vt100_graphics(void);
 void madtty_set_handler(madtty_t *, madtty_handler_t);
 void madtty_init_colors(void);
 void madtty_init_vt100_graphics(void);
 void madtty_set_handler(madtty_t *, madtty_handler_t);
+void madtty_set_data(madtty_t *, void *);
+void *madtty_get_data(madtty_t *);
 int madtty_color_pair(int fg, int bg);
 
 madtty_t *madtty_create(int rows, int cols);
 int madtty_color_pair(int fg, int bg);
 
 madtty_t *madtty_create(int rows, int cols);