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 */
14 #define DWCHAR 0x40000000u /* 2nd half of a fullwidth char */
27 int screen
[NROWS
* NCOLS
]; /* screen content */
28 int hist
[NHIST
* NCOLS
]; /* scrolling history */
29 short fgs
[NROWS
* NCOLS
]; /* foreground color */
30 short 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 histtail
; /* the next history row */
35 int lazy
; /* lazy mode */
36 int pid
; /* pid of the terminal program */
37 int top
, bot
; /* terminal top and bot */
40 void term_load(struct term
*term
, int visible
);
41 void term_save(struct term
*term
);
44 void term_send(int c
);
45 void term_exec(char **args
);
47 void term_screenshot(void);
48 void term_hist(int pos
);
49 void term_redraw(int all
);
52 #define FN_I 0x100 /* italic font */
53 #define FN_B 0x200 /* bold font */
54 #define FN_C 0x0ff /* font color mask */
58 int pad_font(char *fr
, char *fi
, char *fb
);
59 void pad_put(int ch
, int r
, int c
, int fg
, int bg
);
62 void pad_blank(int c
);
63 void pad_blankrow(int r
, int bg
);
66 struct font
*font_open(char *path
);
67 void font_free(struct font
*font
);
68 int font_rows(struct font
*font
);
69 int font_cols(struct font
*font
);
70 int font_bitmap(struct font
*font
, void *dst
, int c
);
73 void scr_snap(void *owner
);
74 int scr_load(void *owner
);
75 void scr_free(void *owner
);