File: scrn.h

package info (click to toggle)
jupp 3.1.38-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 2,420 kB
  • sloc: ansic: 31,382; sh: 4,199; makefile: 431
file content (170 lines) | stat: -rw-r--r-- 4,347 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/*
 *	device-independent TTY interface for JOE
 *	Copyright
 *		(C) 1992 Joseph H. Allen
 *
 *	This file is part of JOE (Joe's Own Editor)
 */
#ifndef _JOE_SCRN_H
#define _JOE_SCRN_H 1

#ifdef EXTERN
__IDSTRING(rcsid_scrn_h, "$MirOS: contrib/code/jupp/scrn.h,v 1.12 2018/01/08 00:56:27 tg Exp $");
#endif

#include "tty.h"		/* ttputc() */

extern int skiptop;

/* SCRN *nopen(void);
 *
 * Open the screen (sets TTY mode so that screen may be used immediatly after
 * the 'nopen').
 */
SCRN *nopen(CAP *cap);

/* void nresize(SCRN *t,int w,int h);
 *
 * Change size of screen.  For example, call this when you find out that
 * the Xterm changed size.
 */
void nresize(SCRN *t, int w, int h);

/* void nredraw(SCRN *t);
 *
 * Invalidate all state variables for the terminal.  This way, everything gets
 * redrawn.
 */
void nredraw(SCRN *t);

void npartial(SCRN *t);
void nescape(SCRN *t);
void nreturn(SCRN *t);

/* void nclose(SCRN *t);
 *
 * Close the screen and restore TTY to initial state.
 *
 * if 'flg' is set, tclose doesn't mess with the signals.
 */
void nclose(SCRN *t);

/* int cpos(SCRN *t,int x,int y);
 *
 * Set cursor position
 */
int cpos(register SCRN *t, register int x, register int y);

/* int attr(SCRN *t,int a);
 *
 * Set attributes
 */
int set_attr(SCRN *t, int c);

/* Encode character as utf8 */
void utf8_putc(int c);

/* void outatr(SCRN *t,int *scrn,int *attr,int x,int y,int c,int a);
 *
 * Output a character at the given screen cooridinate.  The cursor position
 * after this function is executed is indeterminate.
 */

/* Character attribute bits */

#define INVERSE		 256
#define UNDERLINE	 512
#define BOLD		1024
#define BLINK		2048
#define DIM		4096
#define AT_MASK		(INVERSE+UNDERLINE+BOLD+BLINK+DIM)

#define BG_SHIFT 13
#define BG_VALUE (7<<BG_SHIFT)
#define BG_NOT_DEFAULT (8<<BG_SHIFT)
#define BG_MASK (15<<BG_SHIFT)

#define BG_DEFAULT (0<<BG_SHIFT) /* default */
#define BG_BLACK (8<<BG_SHIFT)
#define BG_RED (9<<BG_SHIFT)
#define BG_GREEN (10<<BG_SHIFT)
#define BG_YELLOW (11<<BG_SHIFT)
#define BG_BLUE (12<<BG_SHIFT)
#define BG_MAGENTA (13<<BG_SHIFT)
#define BG_CYAN (14<<BG_SHIFT)
#define BG_WHITE (15<<BG_SHIFT)

#define FG_SHIFT 17
#define FG_VALUE (7<<FG_SHIFT)
#define FG_NOT_DEFAULT (8<<FG_SHIFT)
#define FG_MASK (15<<FG_SHIFT)

#define FG_DEFAULT (0<<FG_SHIFT)
#define FG_WHITE (8<<FG_SHIFT) /* default */
#define FG_CYAN (9<<FG_SHIFT)
#define FG_MAGENTA (10<<FG_SHIFT)
#define FG_BLUE (11<<FG_SHIFT)
#define FG_YELLOW (12<<FG_SHIFT)
#define FG_GREEN (13<<FG_SHIFT)
#define FG_RED (14<<FG_SHIFT)
#define FG_BLACK (15<<FG_SHIFT)

#define HAS_COMBINING 0x200000

void outatr(struct charmap *map,SCRN *t,int *scrn,int *attrf,int xx,int yy,int c,int a);
void outatr_help(SCRN *, int *, int *, int, int, int, int);

/* int eraeol(SCRN *t,int x,int y);
 *
 * Erase from screen coordinate to end of line.
 */
int eraeol(SCRN *t, int x, int y);

/* void nscrlup(SCRN *t,int top,int bot,int amnt);
 *
 * Buffered scroll request.  Request that some lines up.  'top' and 'bot'
 * indicate which lines to scroll.  'bot' is the last line to scroll + 1.
 * 'amnt' is distance in lines to scroll.
 */
void nscrlup(SCRN *t, int top, int bot, int amnt);

/* void nscrldn(SCRN *t,int top,int bot,int amnt);
 *
 * Buffered scroll request.  Scroll some lines down.  'top' and 'bot'
 * indicate which lines to scroll.  'bot' is the last line to scroll + 1.
 * 'amnt' is distance in lines to scroll.
 */
void nscrldn(SCRN *t, int top, int bot, int amnt);

/* void nscroll(SCRN *t);
 *
 * Execute buffered scroll requests
 */
void nscroll(SCRN *t);

/* void magic(SCRN *t,int y,int *cur,int *new);
 *
 * Figure out and execute line shifting
 */
void magic(SCRN *t, int y, int *cs, int *ca, int *s, int *a,int placex);

int clrins(SCRN *t);

int meta_color(unsigned char *s);

/* Generate a field */
void genfield(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);

/* Column width of a string takes into account utf-8) */
int txtwidth(unsigned char *s,int len);

/* Generate a field: formatted */
void genfmt(SCRN *t, int x, int y, int ofst, const unsigned char *s, int flg);

/* Column width of formatted string */
int fmtlen(const unsigned char *s);

/* Offset within formatted string of particular column */
int fmtpos(unsigned char *s, int goal);

#endif