1 /* api.h - Copyright (c) 2018, Sijmen J. Mulder (see LICENSE.md) */
2 
3 #define TT_NLINES	24
4 #define TT_NCOLS	40
5 
6 /* 3 color RGB */
7 enum ttcolor {
8 	TT_BLACK,
9 	TT_RED,
10 	TT_GREEN,
11 	TT_YELLOW,
12 	TT_BLUE,
13 	TT_MAGENTA,
14 	TT_CYAN,
15 	TT_WHITE
16 };
17 
18 enum tterr {
19 	TT_OK,
20 	TT_EARG,
21 	TT_ECURL,
22 	TT_EAPI,
23 	TT_EDATA
24 };
25 
26 struct ttattrs {
27 	enum ttcolor	fg;
28 	enum ttcolor	bg;
29 };
30 
31 /* Note on block drawing characters:
32 
33    Teletext supports 6-cell (2x3) block drawing characters. The NOS viewer
34    and API use a custom font with these characters in the 0xF000 Unicode
35    range ('private use').
36 
37    These are all mapped to SUBST_CHAR, defined in api.c */
38 struct ttpage {
39 	wchar_t		chars[TT_NLINES][TT_NCOLS];
40 	struct ttattrs	attrs[TT_NLINES][TT_NCOLS];
41 	char		id[6];
42 	char		nextpage[6];
43 	char		nextsub[6];
44 };
45 
46 enum tterr	 tt_get(const char *id, struct ttpage *page);
47 const char	*tt_errstr(enum tterr err);
48