Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 444 lines (379 sloc) 14.454 kB
8e5c6ee @ThomasDickey Imported Upstream version 1.04
ThomasDickey authored
1 /*
2 ** Copyright (C) 1991, 1997 Free Software Foundation, Inc.
bf1cb5c @ThomasDickey Imported Upstream version 1.06
ThomasDickey authored
3 **
8e5c6ee @ThomasDickey Imported Upstream version 1.04
ThomasDickey authored
4 ** This file is part of TACK.
bf1cb5c @ThomasDickey Imported Upstream version 1.06
ThomasDickey authored
5 **
8e5c6ee @ThomasDickey Imported Upstream version 1.04
ThomasDickey authored
6 ** TACK is free software; you can redistribute it and/or modify
7 ** it under the terms of the GNU General Public License as published by
8 ** the Free Software Foundation; either version 2, or (at your option)
9 ** any later version.
bf1cb5c @ThomasDickey Imported Upstream version 1.06
ThomasDickey authored
10 **
8e5c6ee @ThomasDickey Imported Upstream version 1.04
ThomasDickey authored
11 ** TACK is distributed in the hope that it will be useful,
12 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ** GNU General Public License for more details.
bf1cb5c @ThomasDickey Imported Upstream version 1.06
ThomasDickey authored
15 **
8e5c6ee @ThomasDickey Imported Upstream version 1.04
ThomasDickey authored
16 ** You should have received a copy of the GNU General Public License
17 ** along with TACK; see the file COPYING. If not, write to
18 ** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 ** Boston, MA 02110-1301, USA
20 */
21
e90ffd5 @ThomasDickey Imported Upstream version 1.07
ThomasDickey authored
22 /* $Id: tack.h,v 1.23 2009/12/26 21:25:11 tom Exp $ */
8e5c6ee @ThomasDickey Imported Upstream version 1.04
ThomasDickey authored
23
24 #ifndef NCURSES_TACK_H_incl
25 #define NCURSES_TACK_H_incl 1
26
27 /* terminfo action checker include file */
28
29 #define MAJOR_VERSION 1
e90ffd5 @ThomasDickey Imported Upstream version 1.07
ThomasDickey authored
30 #define MINOR_VERSION 7
8e5c6ee @ThomasDickey Imported Upstream version 1.04
ThomasDickey authored
31
32 #ifdef HAVE_CONFIG_H
33 #include <ncurses_cfg.h>
34 #else
35 #define RETSIGTYPE void
36 #define GCC_UNUSED /*nothing*/
37 #define HAVE_GETTIMEOFDAY 1
38 #define HAVE_SELECT 1
39 #define HAVE_SYS_TIME_H 1
40 #define HAVE_SYS_TIME_SELECT 1
41 #endif
42
43 #include <sys/types.h>
44 #include <stdlib.h>
45 #include <unistd.h>
46 #include <ctype.h>
47 #include <string.h>
bf1cb5c @ThomasDickey Imported Upstream version 1.06
ThomasDickey authored
48 #include <signal.h> /* include before curses.h to work around glibc bug */
8e5c6ee @ThomasDickey Imported Upstream version 1.04
ThomasDickey authored
49
50 #include <curses.h>
51 #include <term_entry.h>
52 #include <nc_tparm.h>
53
54 #if USE_RCS_IDS
55 #define MODULE_ID(id) static const char Ident[] = id;
56 #else
57 #define MODULE_ID(id) /*nothing*/
58 #endif
59
60 #if !HAVE_STRSTR
61 extern char *_nc_strstr(const char *, const char *);
62 #define strstr(h,n) _nc_strstr(h,n)
63 #endif
64
65 #if NO_LEAKS && defined(HAVE__NC_FREE_TIC)
66 extern void _nc_free_tic(int);
67 extern void tack_edit_leaks(void);
68 extern void tack_fun_leaks(void);
69 extern void ExitProgram(int);
70 #else
71 #define ExitProgram(code) exit(code)
72 #undef NO_LEAKS
73 #define NO_LEAKS 0
74 #endif
75
76 #define FreeIfNeeded(p) if (p) { free(p); p = 0; }
77
78 #define CUR_TP (&(cur_term->type))
79 #define MAX_STRINGS NUM_STRINGS(CUR_TP)
80 #define STR_NAME(n) ExtStrname(CUR_TP,n,strnames)
81
82 #define UChar(c) ((unsigned char)(c))
83
84 extern FILE *log_fp;
85 extern FILE *debug_fp;
86 extern int debug_level;
87 extern char temp[];
88 extern char tty_basename[];
89 extern char tty_shortname[];
90
91 #define SYNC_FAILED 0
92 #define SYNC_TESTED 1
93 #define SYNC_NOT_TESTED 2
94 #define SYNC_NEEDED 3
95
96 extern int tty_can_sync;
97 extern int total_pads_sent; /* count pad characters sent */
98 extern int total_caps_sent; /* count caps sent */
99 extern int total_printing_characters; /* count printing characters sent */
bf1cb5c @ThomasDickey Imported Upstream version 1.06
ThomasDickey authored
100 extern SIG_ATOMIC_T no_alarm_event; /* TRUE if the alarm has not gone off yet */
8e5c6ee @ThomasDickey Imported Upstream version 1.04
ThomasDickey authored
101 extern unsigned long usec_run_time; /* length of last test in microseconds */
102 extern int raw_characters_sent; /* Total output characters */
103
104 /* Stopwatch event timers */
105 #define TIME_TEST 0
106 #define TIME_SYNC 1
107 #define TIME_FLUSH 2
108 #define MAX_TIMERS 3
109
110 /* definitions for pad.c */
111
112 #define EXIT_CONDITION (no_alarm_event && (tt_delay_used < tt_delay_max))
113 #define SLOW_TERMINAL_EXIT if (!test_complete && !EXIT_CONDITION) { break; }
114 #define CAP_NOT_FOUND if (auto_pad_mode) return
115
116 extern char letters[26+1];
117 #define NEXT_LETTER letter = letters[letter_number =\
118 letters[letter_number + 1] ? letter_number + 1 : 0]
119
120 extern int test_complete; /* counts number of tests completed */
121 extern char letter;
122 extern int letter_number;
123 extern int augment, repeats;
124 extern long char_sent;
125 extern const char *pad_repeat_test; /* commands that force repeat */
126
127 extern int replace_mode;
128 extern int char_count, line_count, expand_chars;
129 extern int can_go_home, can_clear_screen;
130
131 extern int translate_mode, scan_mode;
132 extern int auto_pad_mode; /* TRUE for auto time tests */
133 extern int char_mask;
134 extern int hex_out; /* Display output in hex */
135
136 /* Parity bit macros */
137 #define STRIP_PARITY 0x7f
138 #define ALLOW_PARITY 0xff
139
140 /* select_delay_type: 0 -> reset all delays
141 1 -> force long delays
142 2 -> do not change the delays */
143 extern int select_delay_type;
144
145 /* select_xon_xoff: 0 -> reset xon/xoff
146 1 -> set xon/xoff
147 2 -> do not change xon/xoff */
148 extern int select_xon_xoff;
149
150 extern int tty_frame_size;
151 extern unsigned tty_baud_rate;
152 extern unsigned long tty_cps; /* The number of characters per second */
bf1cb5c @ThomasDickey Imported Upstream version 1.06
ThomasDickey authored
153 extern SIG_ATOMIC_T not_a_tty;
154 extern int nodelay_read;
8e5c6ee @ThomasDickey Imported Upstream version 1.04
ThomasDickey authored
155 extern int send_reset_init;
156
157 /* definitions for stty_query() and initial_stty_query() */
158 #define TTY_CHAR_MODE 0
159 #define TTY_NOECHO 1
160 #define TTY_OUT_TRANS 2
161 #define TTY_8_BIT 3
162 #define TTY_XON_XOFF 4
163
164 /* scan code definitions */
165 #define MAX_SCAN 256
166
167 /* translate mode default strings */
168 struct default_string_list {
169 const char *name; /* terminfo name */
170 const char *value; /* value of default string */
171 int index; /* index into the strfname[] array */
172 };
173
174 #define TM_last 8
175 extern struct default_string_list TM_string[TM_last];
176
177 /* attribute structure definition */
178 struct mode_list {
179 const char *name;
180 const char *begin_mode;
181 const char *end_mode;
182 int number;
183 };
184
185 extern const struct mode_list alt_modes[];
186 extern const int mode_map[];
187
188 /* Test data base */
189
190 #define FLAG_CAN_TEST 1
191 #define FLAG_TESTED 2
192 #define FLAG_LABEL 4
193 #define FLAG_FUNCTION_KEY 8
194
195 /* caps under test data base */
196
197 #define TT_MAX 8
198 #define MAX_CHANGES (TT_MAX+2)
199
200 extern int tt_delay_max; /* max number of milliseconds we can delay */
201 extern int tt_delay_used; /* number of milliseconds consumed in delay */
202 extern const char *tt_cap[TT_MAX]; /* value of string */
203 extern int tt_affected[TT_MAX]; /* lines or columns effected (repetition
204 factor) */
205 extern int tt_count[TT_MAX]; /* Number of times sent */
206 extern int tt_delay[TT_MAX]; /* Number of milliseconds delay */
207 extern int ttp; /* number of entries used */
208
209 extern const char *tx_cap[TT_MAX]; /* value of string */
210 extern int tx_affected[TT_MAX]; /* lines or columns effected (repetition
211 factor) */
212 extern int tx_count[TT_MAX]; /* Number of times sent */
213 extern int tx_delay[TT_MAX]; /* Number of milliseconds delay */
214 extern int tx_index[TT_MAX]; /* String index */
215 extern int txp; /* number of entries used */
216 extern int tx_characters; /* printing characters sent by test */
217 extern unsigned long tx_cps; /* characters per second */
218
219 /*
220 Menu control for tack.
221 */
222
223 struct test_results {
224 struct test_results *next; /* point to next entry */
225 struct test_list *test; /* Test which got these results */
226 int reps; /* repeat count */
227 int delay; /* delay times 10 */
228 };
229
230 struct test_list {
231 int flags; /* Test description flags */
232 int lines_needed; /* Lines needed for test (0->no action) */
233 const char *caps_done; /* Caps shown in Done message */
234 const char *caps_tested; /* Other caps also being tested */
235 const char *menu_entry; /* Menu entry text (optional) */
236 /* Function that does testing */
237 void (*test_procedure)(struct test_list *, int *, int *);
238 struct test_menu *sub_menu; /* Nested sub-menu */
239 };
240
241 struct test_menu {
242 int flags; /* Menu feature flag */
243 int default_action; /* Default command if <cr> <lf> entered */
244 const char *menu_text; /* Describe this test_menu */
245 const char *menu_title; /* Title for the menu */
246 const char *ident; /* short menu name */
247 const char *standard_tests; /* Standard test text */
248 /* print current settings (optional) */
249 void (*menu_function)(struct test_menu *);
250 struct test_list *tests; /* Pointer to the menu/function pairs */
251 struct test_list *resume_tests; /* Standard test resume point */
252 int resume_state; /* resume state of test group */
253 int resume_char; /* resume ch of test group */
254 };
255
256
257 /* menu flags */
258 #define MENU_100c 0x00001a00 /* Augment 100% of columns */
259 #define MENU_90c 0x00001900 /* Augment 90% of columns */
260 #define MENU_80c 0x00001800 /* Augment 80% of columns */
261 #define MENU_70c 0x00001700 /* Augment 70% of columns */
262 #define MENU_60c 0x00001600 /* Augment 60% of columns */
263 #define MENU_50c 0x00001500 /* Augment 50% of columns */
264 #define MENU_40c 0x00001400 /* Augment 40% of columns */
265 #define MENU_30c 0x00001300 /* Augment 30% of columns */
266 #define MENU_20c 0x00001200 /* Augment 20% of columns */
267 #define MENU_10c 0x00001100 /* Augment 10% of columns */
268 #define MENU_LM1 0x00002e00 /* Augment lines - 1 */
269 #define MENU_100l 0x00002a00 /* Augment 100% of lines */
270 #define MENU_90l 0x00002900 /* Augment 90% of lines */
271 #define MENU_50l 0x00002500 /* Augment 50% of lines */
272 #define MENU_lines 0x00002000 /* Augment of lines */
273 #define MENU_columns 0x00001000 /* Augment of columns */
274 #define MENU_LC_MASK 0x00003000 /* Augment mask for lines and columns */
275 #define MENU_1L 0x00002f00 /* Augment == one */
276 #define MENU_1C 0x00001f00 /* Augment == one */
277 #define MENU_ONE 0x00000f00 /* Augment == one */
278 #define MENU_ONE_MASK 0x00000f00 /* Augment == one mask */
279 #define MENU_REP_MASK 0x00003f00 /* Augment mask */
280
281 #define MENU_CLEAR 0x00010000 /* clear screen */
282 #define MENU_INIT 0x00020000 /* Initialization function */
283 #define MENU_NEXT 0x00040000 /* Next test in sequence */
284 #define MENU_LAST 0x00080000 /* End of menu list */
285 #define MENU_STOP 0x00100000 /* Stop testing next-in-sequence */
286 #define MENU_COMPLETE 0x00200000 /* Test complete after this */
287 #define MENU_MENU 0x00400000 /* Pass the menu name not test name */
288
289 #define REQUEST_PROMPT 256
290
291 /* tack.c */
292 extern struct test_menu edit_menu;
293 extern void show_usage(char *);
294 extern void print_version(void);
295
296 /* output.c */
297 extern char *expand(const char *);
298 extern char *expand_command(const char *);
299 extern char *expand_to(char *, int);
300 extern char *hex_expand_to(char *, int);
301 extern char *print_expand(char *);
302 extern int getchp(int);
303 extern int getnext(int);
304 extern int tc_putch(int);
305 extern int tc_putp(const char *);
306 extern int wait_here(void);
307 extern void go_home(void);
308 extern void home_down(void);
309 extern void maybe_wait(int);
310 extern void ptext(const char *);
311 extern void ptextln(const char *);
312 extern void put_clear(void);
313 extern void put_columns(const char *, int, int);
314 extern void put_cr(void);
315 extern void put_crlf(void);
316 extern void put_dec(char *, int);
317 extern void put_ind(void);
318 extern void put_lf(void);
319 extern void put_newlines(int);
320 extern void put_str(const char *);
321 extern void put_this(int);
322 extern void putchp(int);
323 extern void putln(const char *);
324 extern void read_string(char *, int);
325 extern void three_digit(char *, int);
326 extern void tt_putp(const char *);
327 extern void tt_putparm(NCURSES_CONST char *, int, int, int);
328 extern void tt_tputs(const char *, int);
329
330 #define put_that(n) put_this((int) (n))
331
332 /* control.c */
333 extern struct test_list color_test_list[];
334 extern char *liberated(char *);
335 extern char txt_longer_augment[80];
336 extern char txt_longer_test_time[80];
337 extern char txt_shorter_augment[80];
338 extern char txt_shorter_test_time[80];
339 extern int msec_cost(const char *const, int);
340 extern int skip_pad_test(struct test_list *, int *, int *, const char *);
341 extern int sliding_scale(int, int, unsigned long);
342 extern int still_testing(void);
343 extern long event_time(int);
344 extern void control_init(void);
345 extern void dump_test_stats(struct test_list *, int *, int *);
346 extern void event_start(int);
347 extern void longer_augment(struct test_list *, int *, int *);
348 extern void longer_test_time(struct test_list *, int *, int *);
349 extern void pad_test_shutdown(struct test_list *, int);
350 extern void pad_test_startup(int);
351 extern void page_loop(void);
352 extern void set_augment_txt(void);
353 extern void shorter_augment(struct test_list *, int *, int *);
354 extern void shorter_test_time(struct test_list *, int *, int *);
355
356 /* charset.c */
357 extern struct test_list acs_test_list[];
358 extern void set_attr(int);
359 extern void eat_cookie(void);
360 extern void put_mode(char *);
361
362 /* crum.c */
363 extern struct test_list crum_test_list[];
364
365 /* ansi.c */
366 extern void tools_status(struct test_list *, int *, int *);
367 extern void tools_charset(struct test_list *, int *, int *);
368 extern void tools_sgr(struct test_list *, int *, int *);
369
370 /* edit.c */
371 extern struct test_menu change_pad_menu;
372 extern struct test_list edit_test_list[];
373 extern char *get_string_cap_byname(const char *, const char **);
374 extern int cap_match(const char *names, const char *cap);
375 extern int get_string_cap_byvalue(const char *);
376 extern int user_modified(void);
377 extern void can_test(const char *, int);
378 extern void cap_index(const char *, int *);
379 extern void edit_init(void);
380 extern void save_info(struct test_list *, int *, int *);
381 extern void show_report(struct test_list *, int *, int *);
382
383 /* fun.c */
384 extern struct test_list funkey_test_list[];
385 extern struct test_list printer_test_list[];
386 extern void enter_key(const char *, char *, char *);
387 extern int tty_meta_prep(void);
388 extern void tools_report(struct test_list *, int *, int *);
389
390 /* init.c */
391 extern void reset_init(void);
392 extern void display_basic(void);
393 extern void put_name(const char *, const char *);
394 extern void charset_can_test(void);
395 extern void curses_setup(char *);
396 extern void bye_kids(int);
397
398 /* scan.c */
399 extern char **scan_up, **scan_down, **scan_name;
400 extern int scan_key(void);
401 extern unsigned scan_max; /* length of longest scan code */
402 extern unsigned *scan_tested, *scan_length;
403 extern void scan_init(char *fn);
404
405 /* sysdep.c */
406 extern int initial_stty_query(int);
407 extern int stty_query(int);
408 extern void ignoresig(void);
409 extern void read_key(char *, int);
410 extern void set_alarm_clock(int);
411 extern void spin_flush(void);
412 extern void tty_init(void);
413 extern void tty_raw(int, int);
414 extern void tty_reset(void);
415 extern void tty_set(void);
416
417 /* menu.c */
418 extern char prompt_string[80]; /* menu prompt storage */
419 extern int subtest_menu(struct test_list *, int *, int *);
420 extern struct test_list *augment_test;
421 extern void generic_done_message(struct test_list *, int *, int *);
422 extern void menu_can_scan(const struct test_menu *);
423 extern void menu_clear_screen(struct test_list *, int *, int *);
424 extern void menu_display(struct test_menu *, int *);
425 extern void menu_prompt(void);
426 extern void menu_reset_init(struct test_list *, int *, int *);
427 extern void pad_done_message(struct test_list *, int *, int *);
428
429 /* modes.c */
430 extern struct test_list mode_test_list[];
431
432 /* pad.c */
433 extern struct test_list pad_test_list[];
434
435 /* sync.c */
436 extern struct test_menu sync_menu;
437 extern int tty_sync_error(void);
438 extern void flush_input(void);
439 extern void sync_handshake(struct test_list *, int *, int *);
440 extern void sync_test(struct test_menu *);
441 extern void verify_time(void);
442
443 #endif /* NCURSES_TACK_H_incl */
Something went wrong with that request. Please try again.