X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=madtty%2Fmadtty.h;h=c7e2a8240493b2eb79483d3c038c7e1cc672091a;hb=61754ad6e0733a15c837d3ba1c8255731df99c9e;hp=25da678d0ad5656663ff0d5316574746e7bc5de6;hpb=7e9bf69df0c4b6cd9a94172e71d7c6a584341f52;p=apps%2Fmadtty.git diff --git a/madtty/madtty.h b/madtty/madtty.h index 25da678..c7e2a82 100644 --- a/madtty/madtty.h +++ b/madtty/madtty.h @@ -22,44 +22,47 @@ #ifndef MADTTY_MADTTY_H #define MADTTY_MADTTY_H -#include +#include #include #include #include #include #include +#include #define MAX_CSI_ES_PARAMS 32 -#define ESEQ_BUF_SIZE 128 /* size of escape sequence buffer */ -/* Represents each of the text cells in the terminal screen */ -typedef struct { - char s[4]; - char len; - attr_t attrs; -} RoteCell; +typedef struct mtty_row_t mtty_row_t; typedef struct { int pty; pid_t childpid; /* flags */ - unsigned insert : 1; - unsigned escaped : 1; - unsigned graphmode : 1; + unsigned seen_input : 1; + unsigned insert : 1; + unsigned escaped : 1; + unsigned graphmode : 1; + unsigned curshid : 1; /* geometry */ int rows, cols; - int scrolltop, scrollbottom; - RoteCell **cells; + + mtty_row_t *lines; + mtty_row_t *scroll_top; + mtty_row_t *scroll_bot; /* cursor */ - attr_t curattrs; - int curs_row, curs_col; + unsigned curattrs; + mtty_row_t *curs_row; + int curs_col; int curs_srow, curs_scol; - char esbuf[ESEQ_BUF_SIZE]; - int esbuf_len; + /* buffers and parsing state */ + mbstate_t ps; + char rbuf[BUFSIZ]; + char ebuf[BUFSIZ]; + int rlen, elen; } madtty_t; void madtty_initialize(void); @@ -68,12 +71,9 @@ madtty_t *madtty_create(int rows, int cols); void madtty_destroy(madtty_t *rt); pid_t madtty_forkpty(madtty_t *rt, const char *path, const char *argv[]); -int madtty_read(madtty_t *rt, char *buf, int buflen); -int madtty_write(madtty_t *rt, const char *data, int length); - -int madtty_inject(madtty_t *rt, const char *data, int length); +int madtty_process(madtty_t *rt); +void madtty_keypress(madtty_t *rt, int keycode); void madtty_draw(madtty_t *rt, WINDOW *win, int startrow, int startcol); -void madtty_keypress(madtty_t *rt, int keycode); #endif /* MADTTY_MADTTY_H */