]> ncurses.scripts.mit.edu Git - ncurses.git/blob - tack/tack.h
ncurses 5.3
[ncurses.git] / tack / tack.h
1 /*
2 ** Copyright (C) 1991, 1997 Free Software Foundation, Inc.
3 ** 
4 ** This file is part of TACK.
5 ** 
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.
10 ** 
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.
15 ** 
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., 59 Temple Place - Suite 330,
19 ** Boston, MA 02111-1307, USA.
20 */
21
22 /* $Id: tack.h,v 1.9 2001/06/18 18:44:49 tom Exp $ */
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
30 #define MINOR_VERSION 0
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>
48
49 #include <curses.h>
50 #include <term_entry.h>
51
52 #if USE_RCS_IDS
53 #define MODULE_ID(id) static const char Ident[] = id;
54 #else
55 #define MODULE_ID(id) /*nothing*/
56 #endif
57
58 #if !HAVE_STRSTR
59 extern char *_nc_strstr(const char *, const char *);
60 #define strstr(h,n) _nc_strstr(h,n)
61 #endif
62
63 #define UChar(c)    ((unsigned char)(c))
64
65 extern FILE *log_fp;
66 extern FILE *debug_fp;
67 extern int debug_level;
68 extern char temp[];
69 extern char tty_basename[];
70 extern char tty_shortname[];
71
72 #define SYNC_FAILED     0
73 #define SYNC_TESTED     1
74 #define SYNC_NOT_TESTED 2
75 #define SYNC_NEEDED     3
76
77 extern int tty_can_sync;
78 extern int total_pads_sent;     /* count pad characters sent */
79 extern int total_caps_sent;     /* count caps sent */
80 extern int total_printing_characters;   /* count printing characters sent */
81 extern int no_alarm_event;      /* TRUE if the alarm has not gone off yet */
82 extern int usec_run_time;       /* length of last test in microseconds */
83 extern int raw_characters_sent; /* Total output characters */
84
85 /* Stopwatch event timers */
86 #define TIME_TEST 0
87 #define TIME_SYNC 1
88 #define TIME_FLUSH 2
89 #define MAX_TIMERS 3
90
91 /* definitions for pad.c */
92
93 #define EXIT_CONDITION (no_alarm_event && (tt_delay_used < tt_delay_max))
94 #define SLOW_TERMINAL_EXIT if (!test_complete && !EXIT_CONDITION) { break; }
95 #define CAP_NOT_FOUND if (auto_pad_mode) return
96
97 extern char letters[26+1];
98 #define NEXT_LETTER letter = letters[letter_number =\
99         letters[letter_number + 1] ? letter_number + 1 : 0]
100
101 extern int test_complete;       /* counts number of tests completed */
102 extern char letter;
103 extern int letter_number;
104 extern int augment, repeats;
105 extern long char_sent;
106 extern const char *pad_repeat_test;     /* commands that force repeat */
107
108 extern int replace_mode;
109 extern int char_count, line_count, expand_chars;
110 extern int can_go_home, can_clear_screen;
111
112 extern int translate_mode, scan_mode;
113 extern int auto_pad_mode;               /* TRUE for auto time tests */
114 extern int char_mask;
115 extern int hex_out;                     /* Display output in hex */
116
117 /* Parity bit macros */
118 #define STRIP_PARITY 0x7f
119 #define ALLOW_PARITY 0xff
120
121 /* select_delay_type:   0 -> reset all delays
122                         1 -> force long delays
123                         2 -> do not change the delays */
124 extern int select_delay_type;
125
126 /* select_xon_xoff:     0 -> reset xon/xoff
127                         1 -> set xon/xoff
128                         2 -> do not change xon/xoff */
129 extern int select_xon_xoff;
130
131 extern int tty_frame_size;
132 extern unsigned long tty_baud_rate;
133 extern int tty_cps;             /* The number of characters per second */
134 extern int not_a_tty, nodelay_read;
135 extern int send_reset_init;
136
137 /* definitions for stty_query() and initial_stty_query() */
138 #define TTY_CHAR_MODE   0
139 #define TTY_NOECHO      1
140 #define TTY_OUT_TRANS   2
141 #define TTY_8_BIT       3
142 #define TTY_XON_XOFF    4
143
144 /* scan code definitions */
145 #define MAX_SCAN 256
146
147 /* translate mode default strings */
148 struct default_string_list {
149         const char *name;       /* terminfo name */
150         const char *value;      /* value of default string */
151         int index;              /* index into the strfname[] array */
152 };
153
154 #define TM_last 8
155 extern struct default_string_list TM_string[TM_last];
156
157 /* attribute structure definition */
158 struct mode_list {
159         const char *name;
160         const char *begin_mode;
161         const char *end_mode;
162         int number;
163 };
164
165 extern const struct mode_list alt_modes[];
166 extern const int mode_map[];
167
168 /* Test data base */
169
170 #define FLAG_CAN_TEST   1
171 #define FLAG_TESTED     2
172 #define FLAG_LABEL      4
173 #define FLAG_FUNCTION_KEY       8
174
175 /* caps under test data base */
176
177 #define TT_MAX  8
178 #define MAX_CHANGES (TT_MAX+2)
179
180 extern int tt_delay_max;        /* max number of milliseconds we can delay */
181 extern int tt_delay_used;       /* number of milliseconds consumed in delay */
182 extern const char *tt_cap[TT_MAX]; /* value of string */
183 extern int tt_affected[TT_MAX]; /* lines or columns effected (repetition
184                                    factor) */
185 extern int tt_count[TT_MAX];    /* Number of times sent */
186 extern int tt_delay[TT_MAX];    /* Number of milliseconds delay */
187 extern int ttp;                 /* number of entries used */
188
189 extern const char *tx_cap[TT_MAX]; /* value of string */
190 extern int tx_affected[TT_MAX]; /* lines or columns effected (repetition
191                                    factor) */
192 extern int tx_count[TT_MAX];    /* Number of times sent */
193 extern int tx_delay[TT_MAX];    /* Number of milliseconds delay */
194 extern int tx_index[TT_MAX];    /* String index */
195 extern int txp;                 /* number of entries used */
196 extern int tx_characters;       /* printing characters sent by test */
197 extern int tx_cps;              /* characters per second */
198
199 /*
200         Menu control for tack.
201 */
202
203 struct test_results {
204         struct test_results *next;      /* point to next entry */
205         struct test_list *test; /* Test which got these results */
206         int reps;               /* repeat count */
207         int delay;              /* delay times 10 */
208 };
209
210 struct test_list {
211         int flags;              /* Test description flags */
212         int lines_needed;       /* Lines needed for test (0->no action) */
213         const char *caps_done;  /* Caps shown in Done message */
214         const char *caps_tested; /* Other caps also being tested */
215         const char *menu_entry; /* Menu entry text (optional) */
216                                 /* Function that does testing */
217         void (*test_procedure)(struct test_list *, int *, int *);
218         struct test_menu *sub_menu;     /* Nested sub-menu */
219 };
220
221 struct test_menu {
222         int flags;              /* Menu feature flag */
223         int default_action;     /* Default command if <cr> <lf> entered */
224         const char *menu_text;  /* Describe this test_menu */
225         const char *menu_title; /* Title for the menu */
226         const char *ident;      /* short menu name */
227         const char *standard_tests;     /* Standard test text */
228                                 /* print current settings (optional) */
229         void (*menu_function)(struct test_menu *);
230         struct test_list *tests;        /* Pointer to the menu/function pairs */
231         struct test_list *resume_tests; /* Standard test resume point */
232         int resume_state;       /* resume state of test group */
233         int resume_char;        /* resume ch of test group */
234 };
235
236
237 /* menu flags */
238 #define MENU_100c       0x00001a00      /* Augment 100% of columns */
239 #define MENU_90c        0x00001900      /* Augment 90% of columns */
240 #define MENU_80c        0x00001800      /* Augment 80% of columns */
241 #define MENU_70c        0x00001700      /* Augment 70% of columns */
242 #define MENU_60c        0x00001600      /* Augment 60% of columns */
243 #define MENU_50c        0x00001500      /* Augment 50% of columns */
244 #define MENU_40c        0x00001400      /* Augment 40% of columns */
245 #define MENU_30c        0x00001300      /* Augment 30% of columns */
246 #define MENU_20c        0x00001200      /* Augment 20% of columns */
247 #define MENU_10c        0x00001100      /* Augment 10% of columns */
248 #define MENU_LM1        0x00002e00      /* Augment lines - 1 */
249 #define MENU_100l       0x00002a00      /* Augment 100% of lines */
250 #define MENU_90l        0x00002900      /* Augment 90% of lines */
251 #define MENU_50l        0x00002500      /* Augment 50% of lines */
252 #define MENU_lines      0x00002000      /* Augment of lines */
253 #define MENU_columns    0x00001000      /* Augment of columns */
254 #define MENU_LC_MASK    0x00003000      /* Augment mask for lines and columns */
255 #define MENU_1L         0x00002f00      /* Augment == one */
256 #define MENU_1C         0x00001f00      /* Augment == one */
257 #define MENU_ONE        0x00000f00      /* Augment == one */
258 #define MENU_ONE_MASK   0x00000f00      /* Augment == one mask */
259 #define MENU_REP_MASK   0x00003f00      /* Augment mask */
260
261 #define MENU_CLEAR      0x00010000      /* clear screen */
262 #define MENU_INIT       0x00020000      /* Initialization function */
263 #define MENU_NEXT       0x00040000      /* Next test in sequence */
264 #define MENU_LAST       0x00080000      /* End of menu list */
265 #define MENU_STOP       0x00100000      /* Stop testing next-in-sequence */
266 #define MENU_COMPLETE   0x00200000      /* Test complete after this */
267 #define MENU_MENU       0x00400000      /* Pass the menu name not test name */
268
269 #define REQUEST_PROMPT 256
270
271 extern char prompt_string[80];  /* menu prompt storage */
272 extern struct test_menu edit_menu;
273 extern struct test_list *augment_test;
274
275 /* tack.c */
276 extern void show_usage(char *);
277 extern void print_version(void);
278
279 /* output.c */
280 extern void tt_tputs(const char *, int);
281 extern void tt_putp(const char *);
282 extern void tt_putparm(NCURSES_CONST char *, int, int, int);
283 extern int tc_putp(const char *);
284 extern int tc_putch(int);
285 extern void putchp(int);
286 extern void put_cr(void);
287 extern void put_crlf(void);
288 extern void put_clear(void);
289 extern void put_dec(char *, int);
290 extern void put_str(const char *);
291 extern void put_lf(void);
292 extern void put_ind(void);
293 extern void put_newlines(int);
294 extern void put_columns(const char *, int, int);
295 extern void put_this(int);
296 extern void putln(const char *);
297 extern void ptext(const char *);
298 extern void ptextln(const char *);
299 extern void home_down(void);
300 extern void go_home(void);
301 extern void three_digit(char *, int);
302 extern int getchp(int);
303 extern char *expand(const char *);
304 extern char *expand_to(char *, int);
305 extern char *expand_command(const char *);
306 extern char *hex_expand_to(char *, int);
307 extern char *print_expand(char *);
308 extern void maybe_wait(int);
309 extern int wait_here(void);
310 extern void read_string(char *, int);
311 extern int getnext(int);
312
313 /* control.c */
314 extern void event_start(int);
315 extern long event_time(int);
316 extern char *liberated(char *);
317 extern void page_loop(void);
318 extern void control_init(void);
319 extern int msec_cost(const char *const, int);
320 extern int skip_pad_test(struct test_list *, int *, int *, const char *);
321 extern void pad_test_startup(int);
322 extern int still_testing(void);
323 extern void pad_test_shutdown(struct test_list *, int);
324 extern void dump_test_stats(struct test_list *, int *, int *);
325 extern void longer_test_time(struct test_list *, int *, int *);
326 extern void shorter_test_time(struct test_list *, int *, int *);
327 extern char txt_longer_test_time[80];
328 extern char txt_shorter_test_time[80];
329 extern void set_augment_txt(void);
330 extern void longer_augment(struct test_list *, int *, int *);
331 extern void shorter_augment(struct test_list *, int *, int *);
332 extern char txt_longer_augment[80];
333 extern char txt_shorter_augment[80];
334 extern int sliding_scale(int, int, int);
335
336 /* sync.c */
337 extern void verify_time(void);
338 extern int tty_sync_error(void);
339 extern void flush_input(void);
340 extern void sync_test(struct test_menu *);
341 extern void sync_handshake(struct test_list *, int *, int *);
342
343 /* charset.c */
344 extern void set_attr(int);
345 extern void eat_cookie(void);
346 extern void put_mode(char *);
347
348 /* init.c */
349 extern void reset_init(void);
350 extern void display_basic(void);
351 extern void put_name(const char *, const char *);
352 extern void charset_can_test(void);
353 extern void curses_setup(char *);
354 extern void bye_kids(int);
355
356 /* scan.c */
357 extern int scan_key(void);
358 extern void scan_init(char *fn);
359
360 /* ansi.c */
361 extern void tools_status(struct test_list *, int *, int *);
362 extern void tools_charset(struct test_list *, int *, int *);
363 extern void tools_sgr(struct test_list *, int *, int *);
364
365 /* pad.c */
366
367 /* fun.c */
368 extern void enter_key(const char *, char *, char *);
369 extern int tty_meta_prep(void);
370 extern void tools_report(struct test_list *, int *, int *);
371
372 /* sysdep.c */
373 extern void tty_set(void);
374 extern void tty_raw(int, int);
375 extern void tty_init(void);
376 extern void tty_reset(void);
377 extern void spin_flush(void);
378 extern void read_key(char *, int);
379 extern void set_alarm_clock(int);
380 extern void ignoresig(void);
381 extern int stty_query(int);
382 extern int initial_stty_query(int);
383
384 /* edit.c */
385 extern int user_modified(void);
386 extern void save_info(struct test_list *, int *, int *);
387 extern void can_test(const char *, int);
388 extern void cap_index(const char *, int *);
389 extern int cap_match(const char *names, const char *cap);
390 extern void edit_init(void);
391 extern char *get_string_cap_byname(const char *, const char **);
392 extern int get_string_cap_byvalue(const char *);
393 extern void show_report(struct test_list *, int *, int *);
394
395 /* menu.c */
396 extern void menu_prompt(void);
397 extern void menu_can_scan(const struct test_menu *);
398 extern void menu_display(struct test_menu *, int *);
399 extern void generic_done_message(struct test_list *, int *, int *);
400 extern void pad_done_message(struct test_list *, int *, int *);
401 extern void menu_clear_screen(struct test_list *, int *, int *);
402 extern void menu_reset_init(struct test_list *, int *, int *);
403 extern int subtest_menu(struct test_list *, int *, int *);
404
405 #endif /* NCURSES_TACK_H_incl */