fbpad: split the screen at row and column boundaries
[fbpad.git] / fbpad.h
blob4ac8488738d086b3f1ed4aa14017a88f89067223
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 128 /* 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 struct term_state {
21 int row, col;
22 int fg, bg;
23 int mode;
26 struct term {
27 int screen[NROWS * NCOLS]; /* screen content */
28 int hist[NHIST * NCOLS]; /* scrolling history */
29 int fgs[NROWS * NCOLS]; /* foreground color */
30 int bgs[NROWS * NCOLS]; /* background color */
31 int dirty[NROWS]; /* changed rows in lazy mode */
32 struct term_state cur, sav; /* terminal saved state */
33 int fd; /* terminal file descriptor */
34 int hrow; /* the next history row in hist[] */
35 int hpos; /* scrolling history; position */
36 int lazy; /* lazy mode */
37 int pid; /* pid of the terminal program */
38 int top, bot; /* terminal scrolling region */
39 int rows, cols;
42 void term_load(struct term *term, int visible);
43 void term_save(struct term *term);
45 void term_read(void);
46 void term_send(int c);
47 void term_exec(char **args);
48 void term_end(void);
49 void term_screenshot(void);
50 void term_scrl(int pos);
51 void term_redraw(int all);
53 /* pad.c */
54 #define FN_I 0x01000000 /* italic font */
55 #define FN_B 0x02000000 /* bold font */
56 #define FN_C 0x00ffffff /* font color mask */
58 int pad_init(void);
59 void pad_free(void);
60 void pad_conf(int row, int col, int rows, int cols);
61 int pad_font(char *fr, char *fi, char *fb);
62 void pad_put(int ch, int r, int c, int fg, int bg);
63 int pad_rows(void);
64 int pad_cols(void);
65 void pad_fill(int sr, int er, int sc, int ec, int c);
66 void pad_border(unsigned c, int wid);
67 char *pad_fbdev(void);
68 int pad_crows(void);
69 int pad_ccols(void);
71 /* font.c */
72 struct font *font_open(char *path);
73 void font_free(struct font *font);
74 int font_rows(struct font *font);
75 int font_cols(struct font *font);
76 int font_bitmap(struct font *font, void *dst, int c);
78 /* scrsnap.c */
79 void scr_snap(int idx);
80 int scr_load(int idx);
81 void scr_free(int idx);
82 void scr_done(void);