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