File indexing completed on 2024-05-18 08:30:23
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041 #ifndef __TIC_H
0042 #define __TIC_H
0043
0044 #ifdef __cplusplus
0045 extern "C" {
0046 #endif
0047
0048 #include <ncurses_cfg.h>
0049
0050 #include <ncursesw/curses.h> /* for the _tracef() prototype, ERR/OK, bool defs */
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085 #define MAGIC 0432
0086 #define MAGIC2 01036
0087
0088 #undef BYTE
0089 #define BYTE(p,n) (unsigned char)((p)[n])
0090
0091 #define IS_NEG1(p) ((BYTE(p,0) == 0377) && (BYTE(p,1) == 0377))
0092 #define IS_NEG2(p) ((BYTE(p,0) == 0376) && (BYTE(p,1) == 0377))
0093 #define LOW_MSB(p) (BYTE(p,0) + 256*BYTE(p,1))
0094
0095 #define IS_TIC_MAGIC(p) (LOW_MSB(p) == MAGIC || LOW_MSB(p) == MAGIC2)
0096
0097 #define quick_prefix(s) (!strncmp((s), "b64:", (size_t)4) || !strncmp((s), "hex:", (size_t)4))
0098
0099
0100
0101
0102
0103 #define MAX_NAME_SIZE 512
0104 #define MAX_ENTRY_SIZE1 4096
0105 #define MAX_ENTRY_SIZE2 32768
0106
0107 #if NCURSES_EXT_COLORS && HAVE_INIT_EXTENDED_COLOR
0108 #define MAX_ENTRY_SIZE MAX_ENTRY_SIZE2
0109 #else
0110 #define MAX_ENTRY_SIZE MAX_ENTRY_SIZE1
0111 #endif
0112
0113
0114
0115
0116
0117
0118
0119 #if HAVE_LONG_FILE_NAMES
0120 #define MAX_ALIAS 32
0121 #else
0122 #define MAX_ALIAS 14
0123 #endif
0124
0125
0126 #define PRIVATE_INFO "%s/.terminfo"
0127
0128
0129
0130
0131
0132
0133
0134 #define MAX_DEBUG_LEVEL 15
0135 #define DEBUG_LEVEL(n) ((n) << TRACE_SHIFT)
0136
0137 #define set_trace_level(n) \
0138 _nc_tracing &= TRACE_MAXIMUM, \
0139 _nc_tracing |= DEBUG_LEVEL(n)
0140
0141 #ifdef TRACE
0142 #define DEBUG(n, a) if (_nc_tracing >= DEBUG_LEVEL(n)) _tracef a
0143 #else
0144 #define DEBUG(n, a)
0145 #endif
0146
0147
0148
0149
0150
0151
0152
0153
0154 #define BOOLEAN 0
0155 #define NUMBER 1
0156 #define STRING 2
0157 #define CANCEL 3
0158 #define NAMES 4
0159 #define UNDEF 5
0160
0161 #define NO_PUSHBACK -1
0162
0163
0164
0165
0166
0167
0168 struct token
0169 {
0170 char *tk_name;
0171 int tk_valnumber;
0172 char *tk_valstring;
0173 };
0174
0175
0176
0177
0178 struct tinfo_fkeys {
0179 unsigned offset;
0180 chtype code;
0181 };
0182
0183 typedef short HashValue;
0184
0185
0186
0187
0188
0189
0190 struct name_table_entry
0191 {
0192 const char *nte_name;
0193 int nte_type;
0194 HashValue nte_index;
0195 HashValue nte_link;
0196 };
0197
0198
0199
0200
0201 typedef struct {
0202 unsigned table_size;
0203 const HashValue *table_data;
0204 HashValue (*hash_of)(const char *);
0205 int (*compare_names)(const char *, const char *);
0206 } HashData;
0207
0208 struct alias
0209 {
0210 const char *from;
0211 const char *to;
0212 const char *source;
0213 };
0214
0215 #define NOTFOUND ((struct name_table_entry *) 0)
0216
0217
0218
0219
0220
0221
0222 struct user_table_entry
0223 {
0224 const char *ute_name;
0225 int ute_type;
0226 unsigned ute_argc;
0227 unsigned ute_args;
0228 HashValue ute_index;
0229 HashValue ute_link;
0230 };
0231
0232
0233
0234
0235
0236
0237
0238
0239 #define ABSENT_BOOLEAN ((signed char)-1)
0240 #define ABSENT_NUMERIC (-1)
0241 #define ABSENT_STRING (char *)0
0242
0243
0244 #define CANCELLED_BOOLEAN ((signed char)-2)
0245 #define CANCELLED_NUMERIC (-2)
0246 #define CANCELLED_STRING (char *)(-1)
0247
0248 #define VALID_BOOLEAN(s) ((unsigned char)(s) <= 1)
0249 #define VALID_NUMERIC(s) ((s) >= 0)
0250 #define VALID_STRING(s) ((s) != CANCELLED_STRING && (s) != ABSENT_STRING)
0251
0252
0253 #define MAX_TERMCAP_LENGTH 1023
0254
0255
0256 #define MAX_TERMINFO_LENGTH 4096
0257
0258 #ifndef TERMINFO
0259 #define TERMINFO "/usr/share/terminfo"
0260 #endif
0261
0262 #ifdef NCURSES_TERM_ENTRY_H_incl
0263
0264
0265
0266
0267 #ifdef NCURSES_INTERNALS
0268
0269 extern NCURSES_EXPORT(unsigned) _nc_pathlast (const char *);
0270 extern NCURSES_EXPORT(bool) _nc_is_abs_path (const char *);
0271 extern NCURSES_EXPORT(bool) _nc_is_dir_path (const char *);
0272 extern NCURSES_EXPORT(bool) _nc_is_file_path (const char *);
0273 extern NCURSES_EXPORT(char *) _nc_basename (char *);
0274 extern NCURSES_EXPORT(char *) _nc_rootname (char *);
0275
0276
0277 extern NCURSES_EXPORT(const struct name_table_entry *) _nc_get_table (bool);
0278 extern NCURSES_EXPORT(const HashData *) _nc_get_hash_info (bool);
0279 extern NCURSES_EXPORT(const struct alias *) _nc_get_alias_table (bool);
0280
0281
0282 extern NCURSES_EXPORT(struct name_table_entry const *) _nc_find_type_entry
0283 (const char *, int, bool);
0284 extern NCURSES_EXPORT(struct user_table_entry const *) _nc_find_user_entry
0285 (const char *);
0286
0287
0288 extern NCURSES_EXPORT(int) _nc_get_token (bool);
0289 extern NCURSES_EXPORT(void) _nc_panic_mode (char);
0290 extern NCURSES_EXPORT(void) _nc_push_token (int);
0291 extern NCURSES_EXPORT_VAR(int) _nc_curr_col;
0292 extern NCURSES_EXPORT_VAR(int) _nc_curr_line;
0293 extern NCURSES_EXPORT_VAR(int) _nc_syntax;
0294 extern NCURSES_EXPORT_VAR(int) _nc_strict_bsd;
0295 extern NCURSES_EXPORT_VAR(long) _nc_comment_end;
0296 extern NCURSES_EXPORT_VAR(long) _nc_comment_start;
0297 extern NCURSES_EXPORT_VAR(long) _nc_curr_file_pos;
0298 extern NCURSES_EXPORT_VAR(long) _nc_start_line;
0299 #define SYN_TERMINFO 0
0300 #define SYN_TERMCAP 1
0301
0302
0303 extern NCURSES_EXPORT(const char *) _nc_get_source (void);
0304 extern GCC_NORETURN NCURSES_EXPORT(void) _nc_err_abort (const char *const,...) GCC_PRINTFLIKE(1,2);
0305 extern NCURSES_EXPORT(void) _nc_get_type (char *name);
0306 extern NCURSES_EXPORT(void) _nc_set_source (const char *const);
0307 extern NCURSES_EXPORT(void) _nc_set_type (const char *const);
0308 extern GCC_NORETURN NCURSES_EXPORT(void) _nc_syserr_abort (const char *const,...) GCC_PRINTFLIKE(1,2);
0309 extern NCURSES_EXPORT(void) _nc_warning (const char *const,...) GCC_PRINTFLIKE(1,2);
0310 extern NCURSES_EXPORT_VAR(bool) _nc_suppress_warnings;
0311
0312
0313 extern NCURSES_EXPORT_VAR(struct token) _nc_curr_token;
0314
0315
0316 NCURSES_EXPORT(const struct user_table_entry *) _nc_get_userdefs_table (void);
0317 NCURSES_EXPORT(const HashData *) _nc_get_hash_user (void);
0318
0319
0320 extern NCURSES_EXPORT(char *) _nc_captoinfo (const char *, const char *, int const);
0321 extern NCURSES_EXPORT(char *) _nc_infotocap (const char *, const char *, int const);
0322
0323
0324 extern NCURSES_EXPORT(char *) _nc_home_terminfo (void);
0325
0326
0327 #if BROKEN_LINKER
0328 #define _nc_tinfo_fkeys _nc_tinfo_fkeysf()
0329 extern NCURSES_EXPORT(const struct tinfo_fkeys *) _nc_tinfo_fkeysf (void);
0330 #else
0331 extern NCURSES_EXPORT_VAR(const struct tinfo_fkeys) _nc_tinfo_fkeys[];
0332 #endif
0333
0334
0335 #define NUM_PARM 9
0336
0337 extern NCURSES_EXPORT_VAR(int) _nc_tparm_err;
0338
0339 extern NCURSES_EXPORT(int) _nc_tparm_analyze(TERMINAL *, const char *, char **, int *);
0340 extern NCURSES_EXPORT(void) _nc_reset_tparm(TERMINAL *);
0341
0342
0343 extern NCURSES_EXPORT_VAR(unsigned) _nc_tracing;
0344 extern NCURSES_EXPORT(const char *) _nc_visbuf (const char *);
0345 extern NCURSES_EXPORT(const char *) _nc_visbuf2 (int, const char *);
0346
0347
0348 extern NCURSES_EXPORT_VAR(int) _nc_nulls_sent;
0349
0350
0351 extern const char * _nc_progname;
0352
0353
0354 extern NCURSES_EXPORT(const char *) _nc_next_db(DBDIRS *, int *);
0355 extern NCURSES_EXPORT(const char *) _nc_tic_dir (const char *);
0356 extern NCURSES_EXPORT(void) _nc_first_db(DBDIRS *, int *);
0357 extern NCURSES_EXPORT(void) _nc_last_db(void);
0358
0359
0360 extern NCURSES_EXPORT(int) _nc_tic_written (void);
0361
0362 #endif
0363
0364
0365
0366
0367
0368 #undef NCURSES_TACK_1_08
0369 #ifdef NCURSES_INTERNALS
0370 #define NCURSES_TACK_1_08
0371 #else
0372 #define NCURSES_TACK_1_08 GCC_DEPRECATED("upgrade to tack 1.08")
0373 #endif
0374
0375
0376 extern NCURSES_EXPORT(struct name_table_entry const *) _nc_find_entry
0377 (const char *, const HashValue *) NCURSES_TACK_1_08;
0378 extern NCURSES_EXPORT(const HashValue *) _nc_get_hash_table (bool) NCURSES_TACK_1_08;
0379
0380
0381 extern NCURSES_EXPORT(void) _nc_reset_input (FILE *, char *) NCURSES_TACK_1_08;
0382
0383
0384 extern NCURSES_EXPORT(char *) _nc_tic_expand (const char *, bool, int) NCURSES_TACK_1_08;
0385
0386
0387 extern NCURSES_EXPORT(int) _nc_trans_string (char *, char *) NCURSES_TACK_1_08;
0388
0389 #endif
0390
0391 #ifdef __cplusplus
0392 }
0393 #endif
0394
0395
0396 #endif