1 /* $MirOS: contrib/code/jupp/scrn.h,v 1.5 2017/07/09 01:03:54 tg Exp $ */
3 * Device independant tty interface for JOE
5 * (C) 1992 Joseph H. Allen
7 * This file is part of JOE (Joe's Own Editor)
15 #include "tty.h" /* ttputc() */
21 * Open the screen (sets TTY mode so that screen may be used immediatly after
24 SCRN *nopen PARAMS((CAP *cap));
26 /* void nresize(SCRN *t,int w,int h);
28 * Change size of screen. For example, call this when you find out that
29 * the Xterm changed size.
31 void nresize PARAMS((SCRN *t, int w, int h));
33 /* void nredraw(SCRN *t);
35 * Invalidate all state variables for the terminal. This way, everything gets
38 void nredraw PARAMS((SCRN *t));
40 void npartial PARAMS((SCRN *t));
41 void nescape PARAMS((SCRN *t));
42 void nreturn PARAMS((SCRN *t));
44 /* void nclose(SCRN *t);
46 * Close the screen and restore TTY to initial state.
48 * if 'flg' is set, tclose doesn't mess with the signals.
50 void nclose PARAMS((SCRN *t));
52 /* int cpos(SCRN *t,int x,int y);
56 int cpos PARAMS((register SCRN *t, register int x, register int y));
58 /* int attr(SCRN *t,int a);
62 int set_attr PARAMS((SCRN *t, int c));
64 /* Encode character as utf8 */
65 void utf8_putc PARAMS((int c));
67 /* void outatr(SCRN *t,int *scrn,int *attr,int x,int y,int c,int a);
69 * Output a character at the given screen cooridinate. The cursor position
70 * after this function is executed is indeterminate.
73 /* Character attribute bits */
82 extern unsigned atab[];
84 #define outatr(t,scrn,attr,x,y,c,a) do { \
88 *(scrn) = ((unsigned)(c) | atab[a]); \
98 #define AT_MASK (INVERSE+UNDERLINE+BOLD+BLINK+DIM)
101 #define BG_VALUE (7<<BG_SHIFT)
102 #define BG_NOT_DEFAULT (8<<BG_SHIFT)
103 #define BG_MASK (15<<BG_SHIFT)
105 #define BG_DEFAULT (0<<BG_SHIFT) /* default */
106 #define BG_BLACK (8<<BG_SHIFT)
107 #define BG_RED (9<<BG_SHIFT)
108 #define BG_GREEN (10<<BG_SHIFT)
109 #define BG_YELLOW (11<<BG_SHIFT)
110 #define BG_BLUE (12<<BG_SHIFT)
111 #define BG_MAGENTA (13<<BG_SHIFT)
112 #define BG_CYAN (14<<BG_SHIFT)
113 #define BG_WHITE (15<<BG_SHIFT)
116 #define FG_VALUE (7<<FG_SHIFT)
117 #define FG_NOT_DEFAULT (8<<FG_SHIFT)
118 #define FG_MASK (15<<FG_SHIFT)
120 #define FG_DEFAULT (0<<FG_SHIFT)
121 #define FG_WHITE (8<<FG_SHIFT) /* default */
122 #define FG_CYAN (9<<FG_SHIFT)
123 #define FG_MAGENTA (10<<FG_SHIFT)
124 #define FG_BLUE (11<<FG_SHIFT)
125 #define FG_YELLOW (12<<FG_SHIFT)
126 #define FG_GREEN (13<<FG_SHIFT)
127 #define FG_RED (14<<FG_SHIFT)
128 #define FG_BLACK (15<<FG_SHIFT)
130 #define HAS_COMBINING 0x200000
132 void outatr PARAMS((struct charmap *map,SCRN *t,int *scrn,int *attrf,int xx,int yy,int c,int a));
137 * translate character and its attribute into something printable
139 void xlat PARAMS((int *attr, unsigned char *c));
140 void xlat_utf_ctrl PARAMS((int *attr, unsigned char *c));
142 /* int eraeol(SCRN *t,int x,int y);
144 * Erase from screen coordinate to end of line.
146 int eraeol PARAMS((SCRN *t, int x, int y));
148 /* void nscrlup(SCRN *t,int top,int bot,int amnt);
150 * Buffered scroll request. Request that some lines up. 'top' and 'bot'
151 * indicate which lines to scroll. 'bot' is the last line to scroll + 1.
152 * 'amnt' is distance in lines to scroll.
154 void nscrlup PARAMS((SCRN *t, int top, int bot, int amnt));
156 /* void nscrldn(SCRN *t,int top,int bot,int amnt);
158 * Buffered scroll request. Scroll some lines down. 'top' and 'bot'
159 * indicate which lines to scroll. 'bot' is the last line to scroll + 1.
160 * 'amnt' is distance in lines to scroll.
162 void nscrldn PARAMS((SCRN *t, int top, int bot, int amnt));
164 /* void nscroll(SCRN *t);
166 * Execute buffered scroll requests
168 void nscroll PARAMS((SCRN *t));
170 /* void magic(SCRN *t,int y,int *cur,int *new);
172 * Figure out and execute line shifting
174 void magic PARAMS((SCRN *t, int y, int *cs, int *ca, int *s, int *a,int placex));
176 int clrins PARAMS((SCRN *t));
178 int meta_color PARAMS((unsigned char *s));
180 /* Generate a field */
181 void genfield PARAMS((SCRN *t,int *scrn,int *attr,int x,int y,int ofst,unsigned char *s,int len,int atr,int width,int flg,int *fmt));
183 /* Column width of a string takes into account utf-8) */
184 int txtwidth PARAMS((unsigned char *s,int len));
186 /* Generate a field: formatted */
187 void genfmt PARAMS((SCRN *t, int x, int y, int ofst, const unsigned char *s, int flg));
189 /* Column width of formatted string */
190 int fmtlen PARAMS((const unsigned char *s));
192 /* Offset within formatted string of particular column */
193 int fmtpos PARAMS((unsigned char *s, int goal));