X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=madtty%2Fmadtty.h;h=d36ddfbcaad3f430cc3c8fa1e400e78ff7538f10;hb=6c58525bf7665386fc72f1c5b1a217764c19f775;hp=2defa716bda3b5568b10ab95568fc8a7660eaeb5;hpb=f38bb36465858ae6af3776175010e8c09e70f980;p=apps%2Fmadtty.git diff --git a/madtty/madtty.h b/madtty/madtty.h index 2defa71..d36ddfb 100644 --- a/madtty/madtty.h +++ b/madtty/madtty.h @@ -30,59 +30,20 @@ #include #include -#define MAX_CSI_ES_PARAMS 32 -#define ESEQ_BUF_SIZE 128 /* size of escape sequence buffer */ +void madtty_init_colors(void); +int madtty_color_pair(int fg, int bg); -typedef struct mtty_row_t { - wchar_t *text; - uint16_t *attr; -} mtty_row_t; - -/* Represents each of the text cells in the terminal screen */ -typedef struct { - char s[4]; - char len; - int16_t attrs; -} RoteCell; - -typedef struct { - int pty; - pid_t childpid; - - /* flags */ - unsigned insert : 1; - unsigned escaped : 1; - unsigned graphmode : 1; - - /* geometry */ - int rows, cols; - - mtty_row_t *lines; - mtty_row_t *scroll_top; - mtty_row_t *scroll_bot; - - /* cursor */ - unsigned curattrs; - mtty_row_t *curs_row; - int curs_col; - int curs_srow, curs_scol; - - /* buffers and parsing state */ - mbstate_t ps; - char rbuf[BUFSIZ]; - char esbuf[ESEQ_BUF_SIZE]; - int rbuf_len, esbuf_len; -} madtty_t; - -void madtty_initialize(void); +typedef struct madtty_t madtty_t; 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_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_resize(madtty_t *, int rows, int cols); +void madtty_destroy(madtty_t *); +pid_t madtty_forkpty(madtty_t *, const char *, const char *argv[], int *pty); +int madtty_getpty(madtty_t *); + +int madtty_process(madtty_t *); +void madtty_keypress(madtty_t *, int keycode); +void madtty_draw(madtty_t *, WINDOW *win, int startrow, int startcol); #endif /* MADTTY_MADTTY_H */