HAMMER 42C/Many: Stabilization.
[dragonfly.git] / usr.bin / ee / new_curse.h
blob77bd4b933c24787dcfa787fd3e8d60151400c5e9
1 /*
2 | new_curse.h
4 | A subset of curses developed for use with ae.
6 | written by Hugh Mahon
8 | THIS MATERIAL IS PROVIDED "AS IS". THERE ARE
9 | NO WARRANTIES OF ANY KIND WITH REGARD TO THIS
10 | MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE
11 | IMPLIED WARRANTIES OF MERCHANTABILITY AND
12 | FITNESS FOR A PARTICULAR PURPOSE. Neither
13 | Hewlett-Packard nor Hugh Mahon shall be liable
14 | for errors contained herein, nor for
15 | incidental or consequential damages in
16 | connection with the furnishing, performance or
17 | use of this material. Neither Hewlett-Packard
18 | nor Hugh Mahon assumes any responsibility for
19 | the use or reliability of this software or
20 | documentation. This software and
21 | documentation is totally UNSUPPORTED. There
22 | is no support contract available. Hewlett-
23 | Packard has done NO Quality Assurance on ANY
24 | of the program or documentation. You may find
25 | the quality of the materials inferior to
26 | supported materials.
28 | This software is not a product of Hewlett-Packard, Co., or any
29 | other company. No support is implied or offered with this software.
30 | You've got the source, and you're on your own.
32 | This software may be distributed under the terms of Larry Wall's
33 | Artistic license, a copy of which is included in this distribution.
35 | This notice must be included with this software and any derivatives.
37 | Copyright (c) 1986, 1987, 1988, 1991, 1995 Hugh Mahon
38 | All are rights reserved.
40 | $FreeBSD: src/usr.bin/ee/new_curse.h,v 1.2.8.1 2001/06/10 11:06:06 sobomax Exp $
41 | $DragonFly: src/usr.bin/ee/new_curse.h,v 1.2 2003/06/17 04:29:26 dillon Exp $
45 #include <stdio.h>
47 #ifdef SYS5
48 #include <termio.h>
49 #else
50 #include <sgtty.h>
51 #include <fcntl.h>
52 #endif
54 #define KEY_BREAK 0401
55 #define KEY_DOWN 0402
56 #define KEY_UP 0403
57 #define KEY_LEFT 0404
58 #define KEY_RIGHT 0405
59 #define KEY_HOME 0406
60 #define KEY_BACKSPACE 0407
61 #define KEY_F0 0410
62 #define KEY_F(n) (KEY_F0+(n))
63 #define KEY_DL 0510
64 #define KEY_IL 0511
65 #define KEY_DC 0512
66 #define KEY_IC 0513
67 #define KEY_EIC 0514
68 #define KEY_CLEAR 0515
69 #define KEY_EOS 0516
70 #define KEY_EOL 0517
71 #define KEY_SF 0520
72 #define KEY_SR 0521
73 #define KEY_NPAGE 0522
74 #define KEY_PPAGE 0523
75 #define KEY_STAB 0524
76 #define KEY_CTAB 0525
77 #define KEY_CATAB 0526
78 #define KEY_ENTER 0527
79 #define KEY_SRESET 0530
80 #define KEY_RESET 0531
81 #define KEY_PRINT 0532
82 #define KEY_LL 0533
83 #define KEY_A1 0534
84 #define KEY_A3 0535
85 #define KEY_B2 0536
86 #define KEY_C1 0537
87 #define KEY_C3 0540
88 #define KEY_BTAB 0541
89 #define KEY_BEG 0542
90 #define KEY_CANCEL 0543
91 #define KEY_CLOSE 0544
92 #define KEY_COMMAND 0545
93 #define KEY_COPY 0546
94 #define KEY_CREATE 0547
95 #define KEY_END 0550
96 #define KEY_EXIT 0551
97 #define KEY_FIND 0552
98 #define KEY_HELP 0553
99 #define KEY_MARK 0554
100 #define KEY_MESSAGE 0555
101 #define KEY_MOVE 0556
102 #define KEY_NEXT 0557
103 #define KEY_OPEN 0560
104 #define KEY_OPTIONS 0561
105 #define KEY_PREVIOUS 0562
106 #define KEY_REDO 0563
107 #define KEY_REFERENCE 0564
108 #define KEY_REFRESH 0565
109 #define KEY_REPLACE 0566
110 #define KEY_RESTART 0567
111 #define KEY_RESUME 0570
112 #define KEY_SAVE 0571
113 #define KEY_SBEG 0572
114 #define KEY_SCANCEL 0573
115 #define KEY_SCOMMAND 0574
116 #define KEY_SCOPY 0575
117 #define KEY_SCREATE 0576
118 #define KEY_SDC 0577
119 #define KEY_SDL 0600
120 #define KEY_SELECT 0601
121 #define KEY_SEND 0602
122 #define KEY_SEOL 0603
123 #define KEY_SEXIT 0604
124 #define KEY_SFIND 0605
125 #define KEY_SHELP 0606
126 #define KEY_SHOME 0607
127 #define KEY_SIC 0610
128 #define KEY_SLEFT 0611
129 #define KEY_SMESSAGE 0612
130 #define KEY_SMOVE 0613
131 #define KEY_SNEXT 0614
132 #define KEY_SOPTIONS 0615
133 #define KEY_SPREVIOUS 0616
134 #define KEY_SPRINT 0617
135 #define KEY_SREDO 0620
136 #define KEY_SREPLACE 0621
137 #define KEY_SRIGHT 0622
138 #define KEY_SRSUME 0623
139 #define KEY_SSAVE 0624
140 #define KEY_SSUSPEND 0625
141 #define KEY_SUNDO 0626
142 #define KEY_SUSPEND 0627
143 #define KEY_UNDO 0630
145 #define TRUE 1
146 #define FALSE 0
148 #define A_STANDOUT 0001 /* standout mode */
149 #define A_NC_BIG5 0x0100 /* Handle Chinese Big5 characters */
150 #define SCROLL 1 /* text has been scrolled */
151 #define CLEAR 2 /* window has been cleared */
152 #define CHANGE 3 /* window has been changed */
153 #define UP 1 /* direction of scroll */
154 #define DOWN 2
156 struct _line {
157 struct _line *next_screen;
158 struct _line *prev_screen;
159 char *row;
160 char *attributes;
161 int last_char;
162 int changed;
163 int scroll;
164 int number;
167 struct _line *top_of_win;
169 typedef struct WIND {
170 int SR; /* starting row */
171 int SC; /* starting column */
172 int LC; /* last column */
173 int LX; /* last cursor column position */
174 int LY; /* last cursor row position */
175 int Attrib; /* attributes active in window */
176 int Num_lines; /* number of lines */
177 int Num_cols; /* number of columns */
178 int scroll_up; /* number of lines moved */
179 int scroll_down;
180 int SCROLL_CLEAR; /* indicates that window has been scrolled or cleared */
181 struct _line *first_line;
182 } WINDOW;
184 extern WINDOW *curscr;
185 extern WINDOW *stdscr;
187 extern int LINES, COLS;
189 #if __STDC__ || defined(__cplusplus)
190 #define P_(s) s
191 #else
192 #define P_(s) ()
193 #endif
195 extern void copy_window P_((WINDOW *origin, WINDOW *destination));
196 extern void reinitscr P_((int));
197 extern void initscr P_((void));
198 extern int Get_int P_((void));
199 extern int INFO_PARSE P_((void));
200 extern int AtoI P_((void));
201 extern void Key_Get P_((void));
202 extern void keys_vt100 P_((void));
203 extern struct _line *Screenalloc P_((int columns));
204 extern WINDOW *newwin P_((int lines, int cols, int start_l, int start_c));
205 extern int Operation P_((int Temp_Stack[], int place));
206 extern void Info_Out P_((char *string, int p_list[], int place));
207 extern void wmove P_((WINDOW *window, int row, int column));
208 extern void clear_line P_((struct _line *line, int column, int cols));
209 extern void werase P_((WINDOW *window));
210 extern void wclrtoeol P_((WINDOW *window));
211 extern void wrefresh P_((WINDOW *window));
212 extern void touchwin P_((WINDOW *window));
213 extern void wnoutrefresh P_((WINDOW *window));
214 extern void flushinp P_((void));
215 extern void ungetch P_((int c));
216 extern int wgetch P_((WINDOW *window));
217 extern void Clear P_((int));
218 extern int Get_key P_((int first_char));
219 extern void waddch P_((WINDOW *window, int c));
220 extern void winsertln P_((WINDOW *window));
221 extern void wdeleteln P_((WINDOW *window));
222 extern void wclrtobot P_((WINDOW *window));
223 extern void wstandout P_((WINDOW *window));
224 extern void wstandend P_((WINDOW *window));
225 extern void waddstr P_((WINDOW *window, char *string));
226 extern void clearok P_((WINDOW *window, int flag));
227 extern void echo P_((void));
228 extern void noecho P_((void));
229 extern void raw P_((void));
230 extern void noraw P_((void));
231 extern void nl P_((void));
232 extern void nonl P_((void));
233 extern void saveterm P_((void));
234 extern void fixterm P_((void));
235 extern void resetterm P_((void));
236 extern void nodelay P_((WINDOW *window, int flag));
237 extern void idlok P_((WINDOW *window, int flag));
238 extern void keypad P_((WINDOW *window, int flag));
239 extern void savetty P_((void));
240 extern void resetty P_((void));
241 extern void endwin P_((void));
242 extern void delwin P_((WINDOW *window));
243 extern void wprintw P_((WINDOW *window, const char* format, ...));
244 extern void iout P_((WINDOW *window, int value));
245 extern int Comp_line P_((struct _line *line1, struct _line *line2));
246 extern struct _line *Insert_line P_((int row, int end_row, WINDOW *window));
247 extern struct _line *Delete_line P_((int row, int end_row, WINDOW *window));
248 extern void CLEAR_TO_EOL P_((WINDOW *window, int row, int column));
249 extern int check_delete P_((WINDOW *window, int line, int offset, struct _line *pointer_new, struct _line *pointer_old));
250 extern int check_insert P_((WINDOW *window, int line, int offset, struct _line *pointer_new, struct _line *pointer_old));
251 extern void doupdate P_((void));
252 extern void Position P_((WINDOW *window, int row, int col));
253 extern void Char_del P_((char *line, char *attrib, int offset, int maxlen));
254 extern void Char_ins P_((char *line, char *attrib, int newc, int newatt, int offset, int maxlen));
255 extern void attribute_on P_((void));
256 extern void attribute_off P_((void));
257 extern void Char_out P_((int newc, int newatt, char *line, char *attrib, int offset));
259 extern void nc_setattrib P_((int));
260 extern void nc_clearattrib P_((int));
261 #undef P_