madtty: source code formatting fixes - no functional change
[dvtm.git] / madtty.h
bloba3b08ffb8e5af1625fee67c9cd374280d48491a2
1 /*
2 LICENSE INFORMATION:
3 This program is free software; you can redistribute it and/or
4 modify it under the terms of the GNU Lesser General Public
5 License (LGPL) as published by the Free Software Foundation.
7 Please refer to the COPYING file for more information.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 Copyright © 2004 Bruno T. C. de Oliveira
19 Copyright © 2006 Pierre Habouzit
20 Copyright © 2008-2011 Marc Andre Tanner
23 #ifndef MADTTY_MADTTY_H
24 #define MADTTY_MADTTY_H
26 #include <ncurses.h>
27 #include <stdbool.h>
28 #include <stdint.h>
29 #include <stdlib.h>
30 #include <sys/types.h>
31 #include <unistd.h>
32 #include <wchar.h>
34 enum {
35 /* means escape sequence was handled */
36 MADTTY_HANDLER_OK,
37 /* means the escape sequence was not recognized yet, but
38 * there is hope that it still will once more characters
39 * arrive (i.e. it is not yet complete).
41 * The library will thus continue collecting characters
42 * and calling the handler as each character arrives until
43 * either OK or NOWAY is returned.
45 MADTTY_HANDLER_NOTYET,
46 /* means the escape sequence was not recognized, and there
47 * is no chance that it will even if more characters are
48 * added to it.
50 MADTTY_HANDLER_NOWAY
53 typedef struct madtty_t madtty_t;
54 typedef int (*madtty_handler_t)(madtty_t *, char *es);
56 void madtty_init_colors(void);
57 void madtty_init_vt100_graphics(void);
58 void madtty_set_handler(madtty_t *, madtty_handler_t);
59 void madtty_set_data(madtty_t *, void *);
60 void *madtty_get_data(madtty_t *);
62 madtty_t *madtty_create(int rows, int cols, int scroll_buf_sz);
63 void madtty_resize(madtty_t *, int rows, int cols);
64 void madtty_destroy(madtty_t *);
65 pid_t madtty_forkpty(madtty_t *, const char *, const char *argv[], const char *envp[], int *pty);
66 int madtty_getpty(madtty_t *);
67 unsigned madtty_cursor(madtty_t *t);
69 int madtty_process(madtty_t *);
70 void madtty_keypress(madtty_t *, int keycode);
71 void madtty_keypress_sequence(madtty_t *, const char *seq);
72 void madtty_mouse(madtty_t *t, int x, int y, mmask_t mask);
73 void madtty_dirty(madtty_t *t);
74 void madtty_draw(madtty_t *, WINDOW *win, int startrow, int startcol);
75 void madtty_color_set(WINDOW *win, short fg, short bg);
77 void madtty_scroll(madtty_t *, int rows);
78 void madtty_noscroll(madtty_t *);
80 void madtty_bell(madtty_t *, bool bell);
81 void madtty_togglebell(madtty_t *);
83 #endif /* MADTTY_MADTTY_H */