X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=madtty%2Fmadtty.h;h=8e8424a69afa4d4c5842f8d4ae4010fc2a3d8549;hb=6be1cb501cb582f98b6d800d7adfd7a42677ea77;hp=25da678d0ad5656663ff0d5316574746e7bc5de6;hpb=7e9bf69df0c4b6cd9a94172e71d7c6a584341f52;p=apps%2Fmadtty.git diff --git a/madtty/madtty.h b/madtty/madtty.h index 25da678..8e8424a 100644 --- a/madtty/madtty.h +++ b/madtty/madtty.h @@ -22,58 +22,29 @@ #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 */ +typedef struct madtty_t madtty_t; -/* Represents each of the text cells in the terminal screen */ -typedef struct { - char s[4]; - char len; - attr_t attrs; -} RoteCell; +void madtty_init_colors(void); +void madtty_init_vt100_graphics(void); -typedef struct { - int pty; - pid_t childpid; - - /* flags */ - unsigned insert : 1; - unsigned escaped : 1; - unsigned graphmode : 1; - - /* geometry */ - int rows, cols; - int scrolltop, scrollbottom; - RoteCell **cells; - - /* cursor */ - attr_t curattrs; - int curs_row, curs_col; - int curs_srow, curs_scol; - - char esbuf[ESEQ_BUF_SIZE]; - int esbuf_len; -} madtty_t; - -void madtty_initialize(void); +int madtty_color_pair(int fg, int bg); 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); -void madtty_draw(madtty_t *rt, WINDOW *win, int startrow, int startcol); - -void madtty_keypress(madtty_t *rt, int keycode); +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 */