Codebase list tack / debian/1.07-1_mentors3 tack.h
debian/1.07-1_mentors3

Tree @debian/1.07-1_mentors3 (Download .tar.gz)

tack.h @debian/1.07-1_mentors3raw · history · blame

  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
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
/*
** Copyright (C) 1991, 1997 Free Software Foundation, Inc.
**
** This file is part of TACK.
**
** TACK is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2, or (at your option)
** any later version.
**
** TACK is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with TACK; see the file COPYING.  If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA
*/

/* $Id: tack.h,v 1.23 2009/12/26 21:25:11 tom Exp $ */

#ifndef NCURSES_TACK_H_incl
#define NCURSES_TACK_H_incl 1

/* terminfo action checker include file */

#define MAJOR_VERSION 1
#define MINOR_VERSION 7

#ifdef HAVE_CONFIG_H
#include <ncurses_cfg.h>
#else
#define RETSIGTYPE void
#define GCC_UNUSED /*nothing*/
#define HAVE_GETTIMEOFDAY 1
#define HAVE_SELECT 1
#define HAVE_SYS_TIME_H 1
#define HAVE_SYS_TIME_SELECT 1
#endif

#include <sys/types.h>
#include <stdlib.h>
#include <unistd.h>
#include <ctype.h>
#include <string.h>
#include <signal.h>	/* include before curses.h to work around glibc bug */

#include <curses.h>
#include <term_entry.h>
#include <nc_tparm.h>

#if USE_RCS_IDS
#define MODULE_ID(id) static const char Ident[] = id;
#else
#define MODULE_ID(id) /*nothing*/
#endif

#if !HAVE_STRSTR
extern char *_nc_strstr(const char *, const char *);
#define strstr(h,n) _nc_strstr(h,n)
#endif

#if NO_LEAKS && defined(HAVE__NC_FREE_TIC)
extern void _nc_free_tic(int);
extern void tack_edit_leaks(void);
extern void tack_fun_leaks(void);
extern void ExitProgram(int);
#else
#define ExitProgram(code) exit(code)
#undef  NO_LEAKS
#define NO_LEAKS 0
#endif

#define FreeIfNeeded(p) if (p) { free(p); p = 0; }

#define CUR_TP      (&(cur_term->type))
#define MAX_STRINGS NUM_STRINGS(CUR_TP)
#define STR_NAME(n) ExtStrname(CUR_TP,n,strnames)

#define UChar(c)    ((unsigned char)(c))

extern FILE *log_fp;
extern FILE *debug_fp;
extern int debug_level;
extern char temp[];
extern char tty_basename[];
extern char tty_shortname[];

#define SYNC_FAILED	0
#define SYNC_TESTED	1
#define SYNC_NOT_TESTED	2
#define SYNC_NEEDED	3

extern int tty_can_sync;
extern int total_pads_sent;	/* count pad characters sent */
extern int total_caps_sent;	/* count caps sent */
extern int total_printing_characters; /* count printing characters sent */
extern SIG_ATOMIC_T no_alarm_event; /* TRUE if the alarm has not gone off yet */
extern unsigned long usec_run_time; /* length of last test in microseconds */
extern int raw_characters_sent;	/* Total output characters */

/* Stopwatch event timers */
#define TIME_TEST 0
#define TIME_SYNC 1
#define TIME_FLUSH 2
#define MAX_TIMERS 3

/* definitions for pad.c */

#define EXIT_CONDITION (no_alarm_event && (tt_delay_used < tt_delay_max))
#define SLOW_TERMINAL_EXIT if (!test_complete && !EXIT_CONDITION) { break; }
#define CAP_NOT_FOUND if (auto_pad_mode) return

extern char letters[26+1];
#define NEXT_LETTER letter = letters[letter_number =\
	letters[letter_number + 1] ? letter_number + 1 : 0]

extern int test_complete;	/* counts number of tests completed */
extern char letter;
extern int letter_number;
extern int augment, repeats;
extern long char_sent;
extern const char *pad_repeat_test;	/* commands that force repeat */

extern int replace_mode;
extern int char_count, line_count, expand_chars;
extern int can_go_home, can_clear_screen;

extern int translate_mode, scan_mode;
extern int auto_pad_mode;		/* TRUE for auto time tests */
extern int char_mask;
extern int hex_out;			/* Display output in hex */

/* Parity bit macros */
#define STRIP_PARITY 0x7f
#define ALLOW_PARITY 0xff

/* select_delay_type:	0 -> reset all delays
			1 -> force long delays
			2 -> do not change the delays */
extern int select_delay_type;

/* select_xon_xoff:	0 -> reset xon/xoff
			1 -> set xon/xoff
			2 -> do not change xon/xoff */
extern int select_xon_xoff;

extern int tty_frame_size;
extern unsigned tty_baud_rate;
extern unsigned long tty_cps;	/* The number of characters per second */
extern SIG_ATOMIC_T not_a_tty;
extern int nodelay_read;
extern int send_reset_init;

/* definitions for stty_query() and initial_stty_query() */
#define TTY_CHAR_MODE	0
#define TTY_NOECHO	1
#define TTY_OUT_TRANS	2
#define TTY_8_BIT	3
#define TTY_XON_XOFF	4

/* scan code definitions */
#define MAX_SCAN 256

/* translate mode default strings */
struct default_string_list {
	const char *name;	/* terminfo name */
	const char *value;	/* value of default string */
	int index;		/* index into the strfname[] array */
};

#define TM_last 8
extern struct default_string_list TM_string[TM_last];

/* attribute structure definition */
struct mode_list {
	const char *name;
	const char *begin_mode;
	const char *end_mode;
	int number;
};

extern const struct mode_list alt_modes[];
extern const int mode_map[];

/* Test data base */

#define FLAG_CAN_TEST	1
#define FLAG_TESTED	2
#define FLAG_LABEL	4
#define FLAG_FUNCTION_KEY	8

/* caps under test data base */

#define TT_MAX	8
#define MAX_CHANGES (TT_MAX+2)

extern int tt_delay_max;	/* max number of milliseconds we can delay */
extern int tt_delay_used;	/* number of milliseconds consumed in delay */
extern const char *tt_cap[TT_MAX]; /* value of string */
extern int tt_affected[TT_MAX];	/* lines or columns effected (repetition
				   factor) */
extern int tt_count[TT_MAX];	/* Number of times sent */
extern int tt_delay[TT_MAX];	/* Number of milliseconds delay */
extern int ttp;			/* number of entries used */

extern const char *tx_cap[TT_MAX]; /* value of string */
extern int tx_affected[TT_MAX];	/* lines or columns effected (repetition
				   factor) */
extern int tx_count[TT_MAX];	/* Number of times sent */
extern int tx_delay[TT_MAX];	/* Number of milliseconds delay */
extern int tx_index[TT_MAX];	/* String index */
extern int txp;			/* number of entries used */
extern int tx_characters;	/* printing characters sent by test */
extern unsigned long tx_cps;	/* characters per second */

/*
	Menu control for tack.
*/

struct test_results {
	struct test_results *next;	/* point to next entry */
	struct test_list *test;	/* Test which got these results */
	int reps;		/* repeat count */
	int delay;		/* delay times 10 */
};

struct test_list {
	int flags;		/* Test description flags */
	int lines_needed;	/* Lines needed for test (0->no action) */
	const char *caps_done;	/* Caps shown in Done message */
	const char *caps_tested; /* Other caps also being tested */
	const char *menu_entry;	/* Menu entry text (optional) */
				/* Function that does testing */
	void (*test_procedure)(struct test_list *, int *, int *);
	struct test_menu *sub_menu;	/* Nested sub-menu */
};

struct test_menu {
	int flags;		/* Menu feature flag */
	int default_action;	/* Default command if <cr> <lf> entered */
	const char *menu_text;	/* Describe this test_menu */
	const char *menu_title;	/* Title for the menu */
	const char *ident;	/* short menu name */
	const char *standard_tests;	/* Standard test text */
				/* print current settings (optional) */
	void (*menu_function)(struct test_menu *);
	struct test_list *tests;	/* Pointer to the menu/function pairs */
	struct test_list *resume_tests;	/* Standard test resume point */
	int resume_state;	/* resume state of test group */
	int resume_char;	/* resume ch of test group */
};


/* menu flags */
#define MENU_100c	0x00001a00	/* Augment 100% of columns */
#define MENU_90c	0x00001900	/* Augment 90% of columns */
#define MENU_80c	0x00001800	/* Augment 80% of columns */
#define MENU_70c	0x00001700	/* Augment 70% of columns */
#define MENU_60c	0x00001600	/* Augment 60% of columns */
#define MENU_50c	0x00001500	/* Augment 50% of columns */
#define MENU_40c	0x00001400	/* Augment 40% of columns */
#define MENU_30c	0x00001300	/* Augment 30% of columns */
#define MENU_20c	0x00001200	/* Augment 20% of columns */
#define MENU_10c	0x00001100	/* Augment 10% of columns */
#define MENU_LM1	0x00002e00	/* Augment lines - 1 */
#define MENU_100l	0x00002a00	/* Augment 100% of lines */
#define MENU_90l	0x00002900	/* Augment 90% of lines */
#define MENU_50l	0x00002500	/* Augment 50% of lines */
#define MENU_lines	0x00002000	/* Augment of lines */
#define MENU_columns	0x00001000	/* Augment of columns */
#define MENU_LC_MASK	0x00003000	/* Augment mask for lines and columns */
#define MENU_1L		0x00002f00	/* Augment == one */
#define MENU_1C		0x00001f00	/* Augment == one */
#define MENU_ONE	0x00000f00	/* Augment == one */
#define MENU_ONE_MASK	0x00000f00	/* Augment == one mask */
#define MENU_REP_MASK	0x00003f00	/* Augment mask */

#define MENU_CLEAR	0x00010000	/* clear screen */
#define MENU_INIT	0x00020000	/* Initialization function */
#define MENU_NEXT	0x00040000	/* Next test in sequence */
#define MENU_LAST	0x00080000	/* End of menu list */
#define MENU_STOP	0x00100000	/* Stop testing next-in-sequence */
#define MENU_COMPLETE	0x00200000	/* Test complete after this */
#define MENU_MENU	0x00400000	/* Pass the menu name not test name */

#define REQUEST_PROMPT 256

/* tack.c */
extern struct test_menu edit_menu;
extern void show_usage(char *);
extern void print_version(void);

/* output.c */
extern char *expand(const char *);
extern char *expand_command(const char *);
extern char *expand_to(char *, int);
extern char *hex_expand_to(char *, int);
extern char *print_expand(char *);
extern int getchp(int);
extern int getnext(int);
extern int tc_putch(int);
extern int tc_putp(const char *);
extern int wait_here(void);
extern void go_home(void);
extern void home_down(void);
extern void maybe_wait(int);
extern void ptext(const char *);
extern void ptextln(const char *);
extern void put_clear(void);
extern void put_columns(const char *, int, int);
extern void put_cr(void);
extern void put_crlf(void);
extern void put_dec(char *, int);
extern void put_ind(void);
extern void put_lf(void);
extern void put_newlines(int);
extern void put_str(const char *);
extern void put_this(int);
extern void putchp(int);
extern void putln(const char *);
extern void read_string(char *, int);
extern void three_digit(char *, int);
extern void tt_putp(const char *);
extern void tt_putparm(NCURSES_CONST char *, int, int, int);
extern void tt_tputs(const char *, int);

#define put_that(n) put_this((int) (n))

/* control.c */
extern struct test_list color_test_list[];
extern char *liberated(char *);
extern char txt_longer_augment[80];
extern char txt_longer_test_time[80];
extern char txt_shorter_augment[80];
extern char txt_shorter_test_time[80];
extern int msec_cost(const char *const, int);
extern int skip_pad_test(struct test_list *, int *, int *, const char *);
extern int sliding_scale(int, int, unsigned long);
extern int still_testing(void);
extern long event_time(int);
extern void control_init(void);
extern void dump_test_stats(struct test_list *, int *, int *);
extern void event_start(int);
extern void longer_augment(struct test_list *, int *, int *);
extern void longer_test_time(struct test_list *, int *, int *);
extern void pad_test_shutdown(struct test_list *, int);
extern void pad_test_startup(int);
extern void page_loop(void);
extern void set_augment_txt(void);
extern void shorter_augment(struct test_list *, int *, int *);
extern void shorter_test_time(struct test_list *, int *, int *);

/* charset.c */
extern struct test_list acs_test_list[];
extern void set_attr(int);
extern void eat_cookie(void);
extern void put_mode(char *);

/* crum.c */
extern struct test_list crum_test_list[];

/* ansi.c */
extern void tools_status(struct test_list *, int *, int *);
extern void tools_charset(struct test_list *, int *, int *);
extern void tools_sgr(struct test_list *, int *, int *);

/* edit.c */
extern struct test_menu change_pad_menu;
extern struct test_list edit_test_list[];
extern char *get_string_cap_byname(const char *, const char **);
extern int cap_match(const char *names, const char *cap);
extern int get_string_cap_byvalue(const char *);
extern int user_modified(void);
extern void can_test(const char *, int);
extern void cap_index(const char *, int *);
extern void edit_init(void);
extern void save_info(struct test_list *, int *, int *);
extern void show_report(struct test_list *, int *, int *);

/* fun.c */
extern struct test_list funkey_test_list[];
extern struct test_list printer_test_list[];
extern void enter_key(const char *, char *, char *);
extern int tty_meta_prep(void);
extern void tools_report(struct test_list *, int *, int *);

/* init.c */
extern void reset_init(void);
extern void display_basic(void);
extern void put_name(const char *, const char *);
extern void charset_can_test(void);
extern void curses_setup(char *);
extern void bye_kids(int);

/* scan.c */
extern char **scan_up, **scan_down, **scan_name;
extern int scan_key(void);
extern unsigned scan_max;	/* length of longest scan code */
extern unsigned *scan_tested, *scan_length;
extern void scan_init(char *fn);

/* sysdep.c */
extern int initial_stty_query(int);
extern int stty_query(int);
extern void ignoresig(void);
extern void read_key(char *, int);
extern void set_alarm_clock(int);
extern void spin_flush(void);
extern void tty_init(void);
extern void tty_raw(int, int);
extern void tty_reset(void);
extern void tty_set(void);

/* menu.c */
extern char prompt_string[80];	/* menu prompt storage */
extern int subtest_menu(struct test_list *, int *, int *);
extern struct test_list *augment_test;
extern void generic_done_message(struct test_list *, int *, int *);
extern void menu_can_scan(const struct test_menu *);
extern void menu_clear_screen(struct test_list *, int *, int *);
extern void menu_display(struct test_menu *, int *);
extern void menu_prompt(void);
extern void menu_reset_init(struct test_list *, int *, int *);
extern void pad_done_message(struct test_list *, int *, int *);

/* modes.c */
extern struct test_list mode_test_list[];

/* pad.c */
extern struct test_list pad_test_list[];

/* sync.c */
extern struct test_menu sync_menu;
extern int tty_sync_error(void);
extern void flush_input(void);
extern void sync_handshake(struct test_list *, int *, int *);
extern void sync_test(struct test_menu *);
extern void verify_time(void);

#endif /* NCURSES_TACK_H_incl */