term: support scrolling history
[fbpad.git] / fbpad.h
blob57fd6d87c619efb53af5a3484e8f8ad44a9f5ef8
1 /* fbpad header file */
3 #define MIN(a, b) ((a) < (b) ? (a) : (b))
4 #define MAX(a, b) ((a) > (b) ? (a) : (b))
5 #define LEN(a) (sizeof(a) / sizeof((a)[0]))
7 #define ESC 27 /* escape code */
8 #define NCOLS 256 /* maximum number of screen columns */
9 #define NROWS 128 /* maximum number of screen rows */
10 #define NDOTS 1024 /* maximum pixels in glyphs */
11 #define NHIST 32 /* scrolling history lines */
13 /* isdw.c */
14 #define DWCHAR 0x40000000u /* 2nd half of a fullwidth char */
16 int isdw(int c);
17 int iszw(int c);
19 /* term.c */
20 #define TERM_HIDDEN 0
21 #define TERM_VISIBLE 1
22 #define TERM_REDRAW 2
24 struct term_state {
25 int row, col;
26 int fg, bg;
27 int mode;
30 struct term {
31 int screen[NROWS * NCOLS];
32 int hist[NHIST * NCOLS];
33 char fgs[NROWS * NCOLS];
34 char bgs[NROWS * NCOLS];
35 struct term_state cur, sav;
36 int fd;
37 int pid;
38 int top, bot;
41 void term_load(struct term *term, int visible);
42 void term_save(struct term *term);
44 void term_read(void);
45 void term_send(int c);
46 void term_exec(char **args);
47 void term_end(void);
48 void term_screenshot(void);
49 void term_hist(int pos);
51 /* pad.c */
52 #define FN_I 0x10
53 #define FN_B 0x20
55 int pad_init(void);
56 void pad_free(void);
57 void pad_put(int ch, int r, int c, int fg, int bg);
58 int pad_rows(void);
59 int pad_cols(void);
60 void pad_blank(int c);
61 void pad_blankrow(int r, int bg);
63 /* font.c */
64 struct font *font_open(char *path);
65 void font_free(struct font *font);
66 int font_rows(struct font *font);
67 int font_cols(struct font *font);
68 int font_bitmap(struct font *font, void *dst, int c);
70 /* scrsnap.c */
71 void scr_snap(void *owner);
72 int scr_load(void *owner);
73 void scr_free(void *owner);