xref: /illumos-gate/usr/src/lib/libxcurses/src/tic/tic.h (revision 09a48d4c)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate  * with the License.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate  * and limitations under the License.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * CDDL HEADER END
217c478bd9Sstevel@tonic-gate  */
227c478bd9Sstevel@tonic-gate /*
237c478bd9Sstevel@tonic-gate  * Copyright (c) 1996, by Sun Microsystems, Inc.
247c478bd9Sstevel@tonic-gate  * All rights reserved.
257c478bd9Sstevel@tonic-gate  */
277c478bd9Sstevel@tonic-gate /*
287c478bd9Sstevel@tonic-gate  *	tic.h			Terminal Information Compiler
297c478bd9Sstevel@tonic-gate  *
307c478bd9Sstevel@tonic-gate  *	Copyright 1990, 1992 by Mortice Kern Systems Inc.  All rights reserved.
317c478bd9Sstevel@tonic-gate  *
327c478bd9Sstevel@tonic-gate  *	Portions of this code Copyright 1982 by Pavel Curtis.
337c478bd9Sstevel@tonic-gate  *
347c478bd9Sstevel@tonic-gate  */
367c478bd9Sstevel@tonic-gate #ifndef tic_h
377c478bd9Sstevel@tonic-gate #define tic_h	1
397c478bd9Sstevel@tonic-gate #ifdef M_RCSID
407c478bd9Sstevel@tonic-gate #ifndef lint
417c478bd9Sstevel@tonic-gate static char const tic_h_rcsID[] = "$Header: /rd/src/tic/rcs/tic.h 1.11 1995/06/22 20:03:36 ant Exp $";
427c478bd9Sstevel@tonic-gate #endif
437c478bd9Sstevel@tonic-gate #endif
457c478bd9Sstevel@tonic-gate #include <mks.h>
467c478bd9Sstevel@tonic-gate #include <stdio.h>
477c478bd9Sstevel@tonic-gate #include <stdlib.h>
487c478bd9Sstevel@tonic-gate #include <string.h>
497c478bd9Sstevel@tonic-gate #include <term.h>
507c478bd9Sstevel@tonic-gate #include <time.h>
527c478bd9Sstevel@tonic-gate extern char *_cmdname;
547c478bd9Sstevel@tonic-gate /* Exit Status */
557c478bd9Sstevel@tonic-gate #define SUCCESS		0
567c478bd9Sstevel@tonic-gate #define NOT_DEFINED	1
577c478bd9Sstevel@tonic-gate #define USAGE		2
587c478bd9Sstevel@tonic-gate #define BAD_TERMINAL	3
597c478bd9Sstevel@tonic-gate #define NOT_VALID	4
607c478bd9Sstevel@tonic-gate #define ERROR		5
627c478bd9Sstevel@tonic-gate #define TERM_NAMES_LENGTH	128
637c478bd9Sstevel@tonic-gate #define TERM_ENTRY_LENGTH	4096
647c478bd9Sstevel@tonic-gate #define swap(x)			(((x >> 8) & 0377) + 256 * (x & 0377))
667c478bd9Sstevel@tonic-gate extern int term_names;		/* string offset */
677c478bd9Sstevel@tonic-gate extern char *string_table;
687c478bd9Sstevel@tonic-gate extern char *source_file;
707c478bd9Sstevel@tonic-gate #ifdef _XOPEN_CURSES
717c478bd9Sstevel@tonic-gate /*
727c478bd9Sstevel@tonic-gate  * MKS XCurses to be conforming has to avoid name space pollution
737c478bd9Sstevel@tonic-gate  * by using reserved prefixes.  Map the pre-XCurses names to the
747c478bd9Sstevel@tonic-gate  * new ones.
757c478bd9Sstevel@tonic-gate  */
767c478bd9Sstevel@tonic-gate #define BOOLCOUNT	__COUNT_BOOL
777c478bd9Sstevel@tonic-gate #define NUMCOUNT	__COUNT_NUM
787c478bd9Sstevel@tonic-gate #define STRCOUNT	__COUNT_STR
797c478bd9Sstevel@tonic-gate #define boolnames       __m_boolnames
807c478bd9Sstevel@tonic-gate #define boolcodes       __m_boolcodes
817c478bd9Sstevel@tonic-gate #define boolfnames      __m_boolfnames
827c478bd9Sstevel@tonic-gate #define numnames        __m_numnames
837c478bd9Sstevel@tonic-gate #define numcodes        __m_numcodes
847c478bd9Sstevel@tonic-gate #define numfnames       __m_numfnames
857c478bd9Sstevel@tonic-gate #define strnames        __m_strnames
867c478bd9Sstevel@tonic-gate #define strcodes        __m_strcodes
877c478bd9Sstevel@tonic-gate #define strfnames       __m_strfnames
887c478bd9Sstevel@tonic-gate #define __t_term_header	terminfo_header_t
897c478bd9Sstevel@tonic-gate #define TERMINFO_MAGIC	__TERMINFO_MAGIC
907c478bd9Sstevel@tonic-gate #define Booleans	_bool
917c478bd9Sstevel@tonic-gate #define Numbers		_num
927c478bd9Sstevel@tonic-gate #define Strings		_str
937c478bd9Sstevel@tonic-gate #endif
957c478bd9Sstevel@tonic-gate extern char boolean[BOOLCOUNT];	/* 0, 1, cancel 2 */
967c478bd9Sstevel@tonic-gate extern short number[NUMCOUNT];	/* positive value, missing -1, cancel -2 */
977c478bd9Sstevel@tonic-gate extern short string[STRCOUNT];	/* positive offset, missing -1, cancel -2 */
997c478bd9Sstevel@tonic-gate extern int check_only;
1007c478bd9Sstevel@tonic-gate extern char *destination;	/* destination directory for object files */
1017c478bd9Sstevel@tonic-gate extern time_t start_time;	/* time at start of compilation */
1027c478bd9Sstevel@tonic-gate extern int curr_line;		/* current line # in input */
1037c478bd9Sstevel@tonic-gate extern long curr_file_pos;	/* file offset of current line */
1047c478bd9Sstevel@tonic-gate extern int debug_level;		/* level of debugging output */
1067c478bd9Sstevel@tonic-gate #define DEBUG(level, fmt, a1) \
1077c478bd9Sstevel@tonic-gate 	if (level <= debug_level) \
1087c478bd9Sstevel@tonic-gate 		 fprintf(stderr, fmt, a1);
1107c478bd9Sstevel@tonic-gate /*
1117c478bd9Sstevel@tonic-gate  *	These are the types of tokens returned by the scanner.
1127c478bd9Sstevel@tonic-gate  *	The first three are also used in the hash table of capability
1137c478bd9Sstevel@tonic-gate  *	names.  The scanner returns one of these values after loading
1147c478bd9Sstevel@tonic-gate  *	the specifics into the global structure curr_token.
115*09a48d4cSRichard Lowe  *
116*09a48d4cSRichard Lowe  *	Note that EOF is also, implicitly, a token type.
1177c478bd9Sstevel@tonic-gate  */
118*09a48d4cSRichard Lowe #define	BOOLEAN	0	/* Boolean capability */
119*09a48d4cSRichard Lowe #define	NUMBER 	1	/* Numeric capability */
120*09a48d4cSRichard Lowe #define	STRING 	2	/* String-valued capability */
121*09a48d4cSRichard Lowe #define	CANCEL 	3	/* Capability to be cancelled in following tc's */
122*09a48d4cSRichard Lowe #define	NAMES  	4	/* The names for a terminal type */
123*09a48d4cSRichard Lowe #define	UNDEF	5	/* Invalid token */
1257c478bd9Sstevel@tonic-gate /*
1267c478bd9Sstevel@tonic-gate  *	The global structure in which the specific parts of a
1277c478bd9Sstevel@tonic-gate  *	scanned token are returned.
1287c478bd9Sstevel@tonic-gate  */
1297c478bd9Sstevel@tonic-gate typedef struct token {
1307c478bd9Sstevel@tonic-gate 	char *tk_name;		/* name of capability */
1317c478bd9Sstevel@tonic-gate 	int tk_valnumber;	/* value of capability (if a number) */
1327c478bd9Sstevel@tonic-gate 	char *tk_valstring;	/* value of capability (if a string) */
1337c478bd9Sstevel@tonic-gate } token;
1357c478bd9Sstevel@tonic-gate extern token curr_token;
1377c478bd9Sstevel@tonic-gate /*
1387c478bd9Sstevel@tonic-gate  *	Functions
1397c478bd9Sstevel@tonic-gate  */
1407c478bd9Sstevel@tonic-gate extern void compile ANSI((void));
1417c478bd9Sstevel@tonic-gate extern void err_abort(char const *_Fmt, ...);	/* GENTEXT: err_abort */
1427c478bd9Sstevel@tonic-gate extern int find(char const *_Capname, void **_Arrayp, int *_Indexp);
1437c478bd9Sstevel@tonic-gate extern void panic_mode ANSI((int _Ch));
1447c478bd9Sstevel@tonic-gate extern void reset ANSI((void));
1457c478bd9Sstevel@tonic-gate extern void reset_input ANSI((void));
1467c478bd9Sstevel@tonic-gate extern void warning(char const *_Fmt, ...);	/* GENTEXT: warning */
1487c478bd9Sstevel@tonic-gate extern int warnings;
1507c478bd9Sstevel@tonic-gate #define syserr_abort	err_abort
1527c478bd9Sstevel@tonic-gate #endif /* tic_h */