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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
|
#ifndef LYCURSES_H
#define LYCURSES_H
/*
* The simple color scheme maps the 8 combinations of bold/underline/reverse
* to the standard 8 ANSI colors (with some variations based on context).
*/
#undef USE_COLOR_TABLE
#ifndef USE_COLOR_STYLE
#if defined(USE_SLANG) || defined(COLOR_CURSES)
#define USE_COLOR_TABLE 1
#endif
#endif
#ifdef TRUE
#undef TRUE /* to prevent parse error :( */
#endif /* TRUE */
#ifdef FALSE
#undef FALSE /* to prevent parse error :( */
#endif /* FALSE */
#ifdef USE_SLANG
#if defined(UNIX) && !defined(unix)
#define unix
#endif /* UNIX && !unix */
#include <slang.h>
#else /* Using curses: */
#ifdef VMS
#define FANCY_CURSES
#endif
/*
* CR may be defined before the curses.h include occurs.
* There is a conflict between the termcap char *CR and the define.
* Assuming that the definition of CR will always be carriage return.
* 06-09-94 Lynx 2-3-1 Garrett Arch Blythe
*/
#ifdef CR
#undef CR /* to prevent parse error :( */
#define REDEFINE_CR
#endif /* CR */
#ifdef DOSPATH
# include "curses.h"
#else
#ifdef NCURSES
# ifdef HAVE_CONFIG_H
# ifdef NCURSESHEADER
# include <ncurses.h>
# else
# include <curses.h>
# endif
extern void LYsubwindow PARAMS((WINDOW * param));
# else /* FIXME: remove this after configure script is complete */
# ifndef NCURSESHEADER
# include <ncurses/curses.h>
# else
# ifdef __NetBSD__
# include <ncurses/ncurses.h>
# else
# include <ncurses.h>
# endif /* __NetBSD__ */
# endif /* HAVE_CONFIG_H */
# endif /* NCURSESHEADER */
#else
# ifdef ULTRIX
# include <cursesX.h> /* ultrix */
# else
# if defined(VMS) && defined(__GNUC__)
# include "LYGCurses.h"
# else
# if defined(sony_news)
# include "/usr/sony/include/jcurses.h" /* sony_news */
# else
# include <curses.h> /* everything else */
# endif /* sony_news */
# endif /* VMS && __GNUC__ */
# endif /* ULTRIX */
#endif /* NCURSES */
#endif /* DOSPATH */
#endif /* USE_SLANG */
/* Both slang and curses: */
#ifndef TRUE
#define TRUE 1
#endif /* !TRUE */
#ifndef FALSE
#define FALSE 0
#endif /* !FALSE */
#ifdef REDEFINE_CR
#define CR FROMASCII('\015')
#endif /* REDEFINE_CR */
extern int LYlines; /* replaces LINES */
extern int LYcols; /* replaces COLS */
#ifndef HTUTILS_H
#include "HTUtils.h"
#endif /* HTUTILS_H */
extern void start_curses NOPARAMS;
extern void stop_curses NOPARAMS;
extern BOOLEAN setup PARAMS((char *terminal));
#ifdef VMS
extern void VMSexit();
extern int ttopen();
extern int ttclose();
extern int ttgetc();
extern void *VMSsignal PARAMS((int sig, void (*func)()));
#ifndef USE_SLANG
extern void VMSbox PARAMS((WINDOW *win, int height, int width));
#endif /* !USE_SLANG */
#endif /* VMS */
#if defined(USE_COLOR_STYLE)
extern void curses_css PARAMS((char * name,int dir));
extern void curses_style PARAMS((int style,int dir,int previous));
extern void curses_w_style PARAMS((WINDOW* win,int style,int dir,int previous));
extern void setHashStyle PARAMS((int style,int color,int cattr,int mono,char* element));
extern void setStyle PARAMS((int style,int color,int cattr,int mono));
extern void wcurses_css PARAMS((WINDOW * win,char* name,int dir));
#define LynxChangeStyle curses_style
#else
extern int slang_style PARAMS((int style,int dir,int previous));
#define LynxChangeStyle slang_style
#endif /* USE_COLOR_STYLE */
#if USE_COLOR_TABLE
extern void lynx_add_attr PARAMS((int a));
extern void lynx_sub_attr PARAMS((int a));
extern void lynx_setup_colors NOPARAMS;
extern unsigned int Lynx_Color_Flags;
#endif
#ifdef USE_SLANG
#if !defined(VMS) && !defined(DJGPP)
#define USE_SLANG_MOUSE 1
#endif
#define SL_LYNX_USE_COLOR 1
#define SL_LYNX_USE_BLINK 2
#define start_bold() lynx_add_attr(1)
#define start_reverse() lynx_add_attr(2)
#define start_underline() lynx_add_attr(4)
#define stop_bold() lynx_sub_attr(1)
#define stop_reverse() lynx_sub_attr(2)
#define stop_underline() lynx_sub_attr(4)
#ifdef FANCY_CURSES
#undef FANCY_CURSES
#endif /* FANCY_CURSES */
/* Map some curses functions to slang functions. */
#define stdscr NULL
#ifdef SLANG_MBCS_HACK
extern int PHYSICAL_SLtt_Screen_Cols;
#define COLS PHYSICAL_SLtt_Screen_Cols
#else
#define COLS SLtt_Screen_Cols
#endif /* SLANG_MBCS_HACK */
#define LINES SLtt_Screen_Rows
#define move SLsmg_gotorc
#define addstr SLsmg_write_string
extern void LY_SLclear NOPARAMS;
#define clear LY_SLclear
#define standout SLsmg_reverse_video
#define standend SLsmg_normal_video
#define clrtoeol SLsmg_erase_eol
#define scrollok(a,b) SLsmg_Newline_Moves = ((b) ? 1 : -1)
#define addch SLsmg_write_char
#define echo()
#define printw SLsmg_printf
extern int curscr;
extern BOOLEAN FullRefresh;
#ifdef clearok
#undef clearok
#endif /* clearok */
#define clearok(a,b) { FullRefresh = (BOOLEAN)b; }
extern void LY_SLrefresh NOPARAMS;
#ifdef refresh
#undef refresh
#endif /* refresh */
#define refresh LY_SLrefresh
#ifdef VMS
extern void VTHome NOPARAMS;
#define endwin() clear(),refresh(),SLsmg_reset_smg(),VTHome()
#else
#define endwin SLsmg_reset_smg(),SLang_reset_tty
#endif /* VMS */
#else /* Define curses functions: */
#ifdef FANCY_CURSES
#ifdef VMS
#ifdef UNDERLINE_LINKS
#define start_bold() setattr(_UNDERLINE)
#define stop_bold() clrattr(_UNDERLINE)
#define start_underline() setattr(_BOLD)
#define stop_underline() clrattr(_BOLD)
#else /* not UNDERLINE_LINKS */
#define start_bold() setattr(_BOLD)
#define stop_bold() clrattr(_BOLD)
#define start_underline() setattr(_UNDERLINE)
#define stop_underline() clrattr(_UNDERLINE)
#endif /* UNDERLINE_LINKS */
#define start_reverse() setattr(_REVERSE)
#define wstart_reverse(a) wsetattr(a,_REVERSE)
#define wstop_underline(a) wclrattr(a,_UNDERLINE)
#define stop_reverse() clrattr(_REVERSE)
#define wstop_reverse(a) wclrattr(a,_REVERSE)
#else /* NOT VMS: */
#if USE_COLOR_TABLE
extern void lynx_add_wattr PARAMS((WINDOW *, int));
extern void lynx_sub_wattr PARAMS((WINDOW *, int));
extern void lynx_set_color PARAMS((int));
extern void lynx_standout PARAMS((int));
extern int lynx_chg_color PARAMS((int, int, int));
#undef standout
#define standout() lynx_standout(TRUE)
#undef standend
#define standend() lynx_standout(FALSE)
#else
#define lynx_add_attr attrset
#define lynx_add_wattr wattrset
#define lynx_sub_attr attroff
#define lynx_sub_wattr wattroff
#endif
#ifdef UNDERLINE_LINKS
#define start_bold() lynx_add_attr(A_UNDERLINE)
#define stop_bold() lynx_sub_attr(A_UNDERLINE)
#define start_underline() lynx_add_attr(A_BOLD)
#define stop_underline() lynx_sub_attr(A_BOLD)
#else /* not UNDERLINE_LINKS: */
#define start_bold() lynx_add_attr(A_BOLD)
#define stop_bold() lynx_sub_attr(A_BOLD)
#define start_underline() lynx_add_attr(A_UNDERLINE)
#define stop_underline() lynx_sub_attr(A_UNDERLINE)
#endif /* UNDERLINE_LINKS */
#if defined(SNAKE) && defined(HP_TERMINAL)
#define start_reverse() lynx_add_wattr(stdscr,A_DIM)
#define wstart_reverse(a) lynx_add_wattr(a,A_DIM)
#define stop_reverse() lynx_sub_wattr(stdscr,A_DIM)
#define wstop_reverse(a) lynx_sub_wattr(a,A_DIM)
#else
#define start_reverse() lynx_add_attr(A_REVERSE)
#define wstart_reverse(a) lynx_add_wattr(a,A_REVERSE)
#define stop_reverse() lynx_sub_attr(A_REVERSE)
#define wstop_reverse(a) lynx_sub_wattr(a,A_REVERSE)
#endif /* SNAKE && HP_TERMINAL */
#endif /* VMS */
#else /* Not FANCY_CURSES: */
#define start_bold() standout()
#define start_underline() /* nothing */
#define start_reverse() standout()
#define wstart_reverse(a) wstandout(a)
#define stop_bold() standend()
#define stop_underline() /* nothing */
#define stop_reverse() standend()
#define wstop_reverse(a) wstandend(a)
#endif /* FANCY_CURSES */
#endif /* USE_SLANG */
extern void lynx_enable_mouse PARAMS((int));
extern void lynx_start_underline_color NOPARAMS;
extern void lynx_stop_underline_color NOPARAMS;
extern void lynx_start_bold_color NOPARAMS;
extern void lynx_stop_bold_color NOPARAMS;
extern void lynx_start_title_color NOPARAMS;
extern void lynx_stop_title_color NOPARAMS;
extern void lynx_start_link_color PARAMS((int));
extern void lynx_stop_link_color PARAMS((int));
extern void lynx_stop_target_color NOPARAMS;
extern void lynx_start_target_color NOPARAMS;
extern void lynx_start_status_color NOPARAMS;
extern void lynx_stop_status_color NOPARAMS;
extern void lynx_start_h1_color NOPARAMS;
extern void lynx_stop_h1_color NOPARAMS;
extern void lynx_start_prompt_color NOPARAMS;
extern void lynx_stop_prompt_color NOPARAMS;
extern void lynx_start_radio_color NOPARAMS;
extern void lynx_stop_radio_color NOPARAMS;
extern void lynx_stop_all_colors NOPARAMS;
#endif /* LYCURSES_H */
|