source: trunk/essentials/sys-libs/ncurses/tack/tack.h

Last change on this file was 2621, checked in by bird, 19 years ago

GNU ncurses 5.5

File size: 13.6 KB
Line 
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., 51 Franklin Street, Fifth Floor,
19** Boston, MA 02110-1301, USA
20*/
21
22/* $Id: tack.h,v 1.14 2005/09/17 19:49:16 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 1
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
59extern 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
65extern FILE *log_fp;
66extern FILE *debug_fp;
67extern int debug_level;
68extern char temp[];
69extern char tty_basename[];
70extern 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
77extern int tty_can_sync;
78extern int total_pads_sent; /* count pad characters sent */
79extern int total_caps_sent; /* count caps sent */
80extern int total_printing_characters; /* count printing characters sent */
81extern int no_alarm_event; /* TRUE if the alarm has not gone off yet */
82extern unsigned long usec_run_time; /* length of last test in microseconds */
83extern 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
97extern char letters[26+1];
98#define NEXT_LETTER letter = letters[letter_number =\
99 letters[letter_number + 1] ? letter_number + 1 : 0]
100
101extern int test_complete; /* counts number of tests completed */
102extern char letter;
103extern int letter_number;
104extern int augment, repeats;
105extern long char_sent;
106extern const char *pad_repeat_test; /* commands that force repeat */
107
108extern int replace_mode;
109extern int char_count, line_count, expand_chars;
110extern int can_go_home, can_clear_screen;
111
112extern int translate_mode, scan_mode;
113extern int auto_pad_mode; /* TRUE for auto time tests */
114extern int char_mask;
115extern 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 */
124extern 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 */
129extern int select_xon_xoff;
130
131extern int tty_frame_size;
132extern unsigned tty_baud_rate;
133extern unsigned long tty_cps; /* The number of characters per second */
134extern int not_a_tty, nodelay_read;
135extern 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 */
148struct 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
155extern struct default_string_list TM_string[TM_last];
156
157/* attribute structure definition */
158struct mode_list {
159 const char *name;
160 const char *begin_mode;
161 const char *end_mode;
162 int number;
163};
164
165extern const struct mode_list alt_modes[];
166extern 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
180extern int tt_delay_max; /* max number of milliseconds we can delay */
181extern int tt_delay_used; /* number of milliseconds consumed in delay */
182extern const char *tt_cap[TT_MAX]; /* value of string */
183extern int tt_affected[TT_MAX]; /* lines or columns effected (repetition
184 factor) */
185extern int tt_count[TT_MAX]; /* Number of times sent */
186extern int tt_delay[TT_MAX]; /* Number of milliseconds delay */
187extern int ttp; /* number of entries used */
188
189extern const char *tx_cap[TT_MAX]; /* value of string */
190extern int tx_affected[TT_MAX]; /* lines or columns effected (repetition
191 factor) */
192extern int tx_count[TT_MAX]; /* Number of times sent */
193extern int tx_delay[TT_MAX]; /* Number of milliseconds delay */
194extern int tx_index[TT_MAX]; /* String index */
195extern int txp; /* number of entries used */
196extern int tx_characters; /* printing characters sent by test */
197extern unsigned long tx_cps; /* characters per second */
198
199/*
200 Menu control for tack.
201*/
202
203struct 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
210struct 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
221struct 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/* tack.c */
272extern struct test_menu edit_menu;
273extern void show_usage(char *);
274extern void print_version(void);
275
276/* output.c */
277extern char *expand(const char *);
278extern char *expand_command(const char *);
279extern char *expand_to(char *, int);
280extern char *hex_expand_to(char *, int);
281extern char *print_expand(char *);
282extern int getchp(int);
283extern int getnext(int);
284extern int tc_putch(int);
285extern int tc_putp(const char *);
286extern int wait_here(void);
287extern void go_home(void);
288extern void home_down(void);
289extern void maybe_wait(int);
290extern void ptext(const char *);
291extern void ptextln(const char *);
292extern void put_clear(void);
293extern void put_columns(const char *, int, int);
294extern void put_cr(void);
295extern void put_crlf(void);
296extern void put_dec(char *, int);
297extern void put_ind(void);
298extern void put_lf(void);
299extern void put_newlines(int);
300extern void put_str(const char *);
301extern void put_this(int);
302extern void putchp(int);
303extern void putln(const char *);
304extern void read_string(char *, int);
305extern void three_digit(char *, int);
306extern void tt_putp(const char *);
307extern void tt_putparm(NCURSES_CONST char *, int, int, int);
308extern void tt_tputs(const char *, int);
309
310#define put_that(n) put_this((int) (n))
311
312/* control.c */
313extern struct test_list color_test_list[];
314extern char *liberated(char *);
315extern char txt_longer_augment[80];
316extern char txt_longer_test_time[80];
317extern char txt_shorter_augment[80];
318extern char txt_shorter_test_time[80];
319extern int msec_cost(const char *const, int);
320extern int skip_pad_test(struct test_list *, int *, int *, const char *);
321extern int sliding_scale(int, int, unsigned long);
322extern int still_testing(void);
323extern long event_time(int);
324extern void control_init(void);
325extern void dump_test_stats(struct test_list *, int *, int *);
326extern void event_start(int);
327extern void longer_augment(struct test_list *, int *, int *);
328extern void longer_test_time(struct test_list *, int *, int *);
329extern void pad_test_shutdown(struct test_list *, int);
330extern void pad_test_startup(int);
331extern void page_loop(void);
332extern void set_augment_txt(void);
333extern void shorter_augment(struct test_list *, int *, int *);
334extern void shorter_test_time(struct test_list *, int *, int *);
335
336/* charset.c */
337extern struct test_list acs_test_list[];
338extern void set_attr(int);
339extern void eat_cookie(void);
340extern void put_mode(char *);
341
342/* crum.c */
343extern struct test_list crum_test_list[];
344
345/* ansi.c */
346extern void tools_status(struct test_list *, int *, int *);
347extern void tools_charset(struct test_list *, int *, int *);
348extern void tools_sgr(struct test_list *, int *, int *);
349
350/* edit.c */
351extern struct test_menu change_pad_menu;
352extern struct test_list edit_test_list[];
353extern char *get_string_cap_byname(const char *, const char **);
354extern int cap_match(const char *names, const char *cap);
355extern int get_string_cap_byvalue(const char *);
356extern int user_modified(void);
357extern void can_test(const char *, int);
358extern void cap_index(const char *, int *);
359extern void edit_init(void);
360extern void save_info(struct test_list *, int *, int *);
361extern void show_report(struct test_list *, int *, int *);
362
363/* fun.c */
364extern struct test_list funkey_test_list[];
365extern struct test_list printer_test_list[];
366extern void enter_key(const char *, char *, char *);
367extern int tty_meta_prep(void);
368extern void tools_report(struct test_list *, int *, int *);
369
370/* init.c */
371extern void reset_init(void);
372extern void display_basic(void);
373extern void put_name(const char *, const char *);
374extern void charset_can_test(void);
375extern void curses_setup(char *);
376extern void bye_kids(int);
377
378/* scan.c */
379extern char **scan_up, **scan_down, **scan_name;
380extern int scan_key(void);
381extern unsigned scan_max; /* length of longest scan code */
382extern unsigned *scan_tested, *scan_length;
383extern void scan_init(char *fn);
384
385/* sysdep.c */
386extern int initial_stty_query(int);
387extern int stty_query(int);
388extern void ignoresig(void);
389extern void read_key(char *, int);
390extern void set_alarm_clock(int);
391extern void spin_flush(void);
392extern void tty_init(void);
393extern void tty_raw(int, int);
394extern void tty_reset(void);
395extern void tty_set(void);
396
397/* menu.c */
398extern char prompt_string[80]; /* menu prompt storage */
399extern int subtest_menu(struct test_list *, int *, int *);
400extern struct test_list *augment_test;
401extern void generic_done_message(struct test_list *, int *, int *);
402extern void menu_can_scan(const struct test_menu *);
403extern void menu_clear_screen(struct test_list *, int *, int *);
404extern void menu_display(struct test_menu *, int *);
405extern void menu_prompt(void);
406extern void menu_reset_init(struct test_list *, int *, int *);
407extern void pad_done_message(struct test_list *, int *, int *);
408
409/* modes.c */
410extern struct test_list mode_test_list[];
411
412/* pad.c */
413extern struct test_list pad_test_list[];
414
415/* sync.c */
416extern struct test_menu sync_menu;
417extern int tty_sync_error(void);
418extern void flush_input(void);
419extern void sync_handshake(struct test_list *, int *, int *);
420extern void sync_test(struct test_menu *);
421extern void verify_time(void);
422
423#endif /* NCURSES_TACK_H_incl */
Note: See TracBrowser for help on using the repository browser.