123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341 |
- #ifndef __TIC_H
- #define __TIC_H
- #ifdef __cplusplus
- extern "C" {
- #endif
- #include <curses.h> /* for the _tracef() prototype, ERR/OK, bool defs */
- #define MAGIC 0432 /* first two bytes of a compiled entry */
- #undef BYTE
- #define BYTE(p,n) (unsigned char)((p)[n])
- #define IS_NEG1(p) ((BYTE(p,0) == 0377) && (BYTE(p,1) == 0377))
- #define IS_NEG2(p) ((BYTE(p,0) == 0376) && (BYTE(p,1) == 0377))
- #define LOW_MSB(p) (BYTE(p,0) + 256*BYTE(p,1))
- #define IS_TIC_MAGIC(p) (LOW_MSB(p) == MAGIC)
- #define MAX_NAME_SIZE 512 /* maximum legal name field size (XSI:127) */
- #define MAX_ENTRY_SIZE 4096 /* maximum legal entry size */
- #if HAVE_LONG_FILE_NAMES
- #define MAX_ALIAS 32 /* smaller than POSIX minimum for PATH_MAX */
- #else
- #define MAX_ALIAS 14 /* SVr3 filename length */
- #endif
- #define PRIVATE_INFO "%s/.terminfo" /* plug getenv("HOME") into %s */
- #define MAX_DEBUG_LEVEL 15
- #define DEBUG_LEVEL(n) ((n) << TRACE_SHIFT)
- #define set_trace_level(n) \
- _nc_tracing &= DEBUG_LEVEL(MAX_DEBUG_LEVEL), \
- _nc_tracing |= DEBUG_LEVEL(n)
- #ifdef TRACE
- #define DEBUG(n, a) if (_nc_tracing >= DEBUG_LEVEL(n)) _tracef a
- #else
- #define DEBUG(n, a) /*nothing*/
- #endif
- extern NCURSES_EXPORT_VAR(unsigned) _nc_tracing;
- extern NCURSES_EXPORT(void) _nc_tracef (char *, ...) GCC_PRINTFLIKE(1,2);
- extern NCURSES_EXPORT(const char *) _nc_visbuf (const char *);
- extern NCURSES_EXPORT(const char *) _nc_visbuf2 (int, const char *);
- #define BOOLEAN 0 /* Boolean capability */
- #define NUMBER 1 /* Numeric capability */
- #define STRING 2 /* String-valued capability */
- #define CANCEL 3 /* Capability to be cancelled in following tc's */
- #define NAMES 4 /* The names for a terminal type */
- #define UNDEF 5 /* Undefined */
- #define NO_PUSHBACK -1 /* used in pushtype to indicate no pushback */
-
- struct token
- {
- char *tk_name;
- int tk_valnumber;
- char *tk_valstring;
- };
- extern NCURSES_EXPORT_VAR(struct token) _nc_curr_token;
-
- struct tinfo_fkeys {
- unsigned offset;
- chtype code;
- };
- #if BROKEN_LINKER
- #define _nc_tinfo_fkeys _nc_tinfo_fkeysf()
- extern NCURSES_EXPORT(const struct tinfo_fkeys *) _nc_tinfo_fkeysf (void);
- #else
- extern NCURSES_EXPORT_VAR(const struct tinfo_fkeys) _nc_tinfo_fkeys[];
- #endif
- typedef short HashValue;
-
- struct name_table_entry
- {
- const char *nte_name;
- int nte_type;
- HashValue nte_index;
- HashValue nte_link;
- };
-
- typedef struct {
- unsigned table_size;
- const HashValue *table_data;
- HashValue (*hash_of)(const char *);
- int (*compare_names)(const char *, const char *);
- } HashData;
- struct alias
- {
- const char *from;
- const char *to;
- const char *source;
- };
- extern NCURSES_EXPORT(const struct name_table_entry *) _nc_get_table (bool);
- extern NCURSES_EXPORT(const HashData *) _nc_get_hash_info (bool);
- extern NCURSES_EXPORT(const HashValue *) _nc_get_hash_table (bool);
- extern NCURSES_EXPORT(const struct alias *) _nc_get_alias_table (bool);
- #define NOTFOUND ((struct name_table_entry *) 0)
- #define ABSENT_BOOLEAN ((signed char)-1) /* 255 */
- #define ABSENT_NUMERIC (-1)
- #define ABSENT_STRING (char *)0
- #define CANCELLED_BOOLEAN ((signed char)-2) /* 254 */
- #define CANCELLED_NUMERIC (-2)
- #define CANCELLED_STRING (char *)(-1)
- #define VALID_BOOLEAN(s) ((unsigned char)(s) <= 1) /* reject "-1" */
- #define VALID_NUMERIC(s) ((s) >= 0)
- #define VALID_STRING(s) ((s) != CANCELLED_STRING && (s) != ABSENT_STRING)
- #define MAX_TERMCAP_LENGTH 1023
- #define MAX_TERMINFO_LENGTH 4096
- #ifndef TERMINFO
- #define TERMINFO "/usr/share/terminfo"
- #endif
- #ifdef NCURSES_TERM_ENTRY_H_incl
- extern NCURSES_EXPORT(unsigned) _nc_pathlast (const char *);
- extern NCURSES_EXPORT(bool) _nc_is_abs_path (const char *);
- extern NCURSES_EXPORT(bool) _nc_is_dir_path (const char *);
- extern NCURSES_EXPORT(bool) _nc_is_file_path (const char *);
- extern NCURSES_EXPORT(char *) _nc_basename (char *);
- extern NCURSES_EXPORT(char *) _nc_rootname (char *);
- extern NCURSES_EXPORT(struct name_table_entry const *) _nc_find_entry
- (const char *, const HashValue *);
- extern NCURSES_EXPORT(struct name_table_entry const *) _nc_find_type_entry
- (const char *, int, bool);
- extern NCURSES_EXPORT(int) _nc_get_token (bool);
- extern NCURSES_EXPORT(void) _nc_panic_mode (char);
- extern NCURSES_EXPORT(void) _nc_push_token (int);
- extern NCURSES_EXPORT(void) _nc_reset_input (FILE *, char *);
- extern NCURSES_EXPORT_VAR(int) _nc_curr_col;
- extern NCURSES_EXPORT_VAR(int) _nc_curr_line;
- extern NCURSES_EXPORT_VAR(int) _nc_syntax;
- extern NCURSES_EXPORT_VAR(int) _nc_strict_bsd;
- extern NCURSES_EXPORT_VAR(long) _nc_comment_end;
- extern NCURSES_EXPORT_VAR(long) _nc_comment_start;
- extern NCURSES_EXPORT_VAR(long) _nc_curr_file_pos;
- extern NCURSES_EXPORT_VAR(long) _nc_start_line;
- #define SYN_TERMINFO 0
- #define SYN_TERMCAP 1
- extern NCURSES_EXPORT(const char *) _nc_get_source (void);
- extern NCURSES_EXPORT(void) _nc_err_abort (const char *const,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN;
- extern NCURSES_EXPORT(void) _nc_get_type (char *name);
- extern NCURSES_EXPORT(void) _nc_set_source (const char *const);
- extern NCURSES_EXPORT(void) _nc_set_type (const char *const);
- extern NCURSES_EXPORT(void) _nc_syserr_abort (const char *const,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN;
- extern NCURSES_EXPORT(void) _nc_warning (const char *const,...) GCC_PRINTFLIKE(1,2);
- extern NCURSES_EXPORT_VAR(bool) _nc_suppress_warnings;
- extern NCURSES_EXPORT(char *) _nc_tic_expand (const char *, bool, int);
- extern NCURSES_EXPORT(int) _nc_trans_string (char *, char *);
- extern NCURSES_EXPORT(char *) _nc_captoinfo (const char *, const char *, int const);
- extern NCURSES_EXPORT(char *) _nc_infotocap (const char *, const char *, int const);
- extern NCURSES_EXPORT(char *) _nc_home_terminfo (void);
- #define NUM_PARM 9
- extern NCURSES_EXPORT_VAR(int) _nc_tparm_err;
- extern NCURSES_EXPORT(int) _nc_tparm_analyze(const char *, char **, int *);
- extern NCURSES_EXPORT_VAR(int) _nc_nulls_sent;
- extern const char * _nc_progname;
- extern NCURSES_EXPORT(const char *) _nc_next_db(DBDIRS *, int *);
- extern NCURSES_EXPORT(const char *) _nc_tic_dir (const char *);
- extern NCURSES_EXPORT(void) _nc_first_db(DBDIRS *, int *);
- extern NCURSES_EXPORT(void) _nc_last_db(void);
- extern NCURSES_EXPORT(int) _nc_tic_written (void);
- #endif /* NCURSES_TERM_ENTRY_H_incl */
- #ifdef __cplusplus
- }
- #endif
- #endif /* __TIC_H */
|