File indexing completed on 2026-04-01 08:35:45
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
0042 #ifndef NCURSES_TERM_ENTRY_H_incl
0043 #define NCURSES_TERM_ENTRY_H_incl 1
0044
0045
0046 #ifdef __cplusplus
0047 extern "C" {
0048 #endif
0049
0050 #include <ncursesw/curses.h>
0051 #include <ncursesw/term.h>
0052
0053
0054
0055
0056 #if NCURSES_XNAMES
0057 #define NUM_BOOLEANS(tp) (tp)->num_Booleans
0058 #define NUM_NUMBERS(tp) (tp)->num_Numbers
0059 #define NUM_STRINGS(tp) (tp)->num_Strings
0060 #define EXT_NAMES(tp,i,limit,index,table) (i >= limit) ? tp->ext_Names[index] : table[i]
0061 #else
0062 #define NUM_BOOLEANS(tp) BOOLCOUNT
0063 #define NUM_NUMBERS(tp) NUMCOUNT
0064 #define NUM_STRINGS(tp) STRCOUNT
0065 #define EXT_NAMES(tp,i,limit,index,table) table[i]
0066 #endif
0067
0068 #define NUM_EXT_NAMES(tp) (unsigned) ((tp)->ext_Booleans + (tp)->ext_Numbers + (tp)->ext_Strings)
0069
0070 #define for_each_boolean(n,tp) for(n = 0; n < NUM_BOOLEANS(tp); n++)
0071 #define for_each_number(n,tp) for(n = 0; n < NUM_NUMBERS(tp); n++)
0072 #define for_each_string(n,tp) for(n = 0; n < NUM_STRINGS(tp); n++)
0073
0074 #if NCURSES_XNAMES
0075 #define for_each_ext_boolean(n,tp) for(n = BOOLCOUNT; (int) n < (int) NUM_BOOLEANS(tp); n++)
0076 #define for_each_ext_number(n,tp) for(n = NUMCOUNT; (int) n < (int) NUM_NUMBERS(tp); n++)
0077 #define for_each_ext_string(n,tp) for(n = STRCOUNT; (int) n < (int) NUM_STRINGS(tp); n++)
0078 #endif
0079
0080 #define ExtBoolname(tp,i,names) EXT_NAMES(tp, i, BOOLCOUNT, (i - (tp->num_Booleans - tp->ext_Booleans)), names)
0081 #define ExtNumname(tp,i,names) EXT_NAMES(tp, i, NUMCOUNT, (i - (tp->num_Numbers - tp->ext_Numbers)) + tp->ext_Booleans, names)
0082 #define ExtStrname(tp,i,names) EXT_NAMES(tp, i, STRCOUNT, (i - (tp->num_Strings - tp->ext_Strings)) + (tp->ext_Numbers + tp->ext_Booleans), names)
0083
0084
0085
0086
0087
0088 #ifdef NCURSES_INTERNALS
0089
0090
0091
0092
0093
0094 typedef enum {
0095 dbdTIC = 0,
0096 #if NCURSES_USE_DATABASE
0097 dbdEnvOnce,
0098 dbdHome,
0099 dbdEnvList,
0100 dbdCfgList,
0101 dbdCfgOnce,
0102 #endif
0103 #if NCURSES_USE_TERMCAP
0104 dbdEnvOnce2,
0105 dbdEnvList2,
0106 dbdCfgList2,
0107 #endif
0108 dbdLAST
0109 } DBDIRS;
0110
0111 #define WARN_MAX_USES 32
0112 #define HARD_MAX_USES 40
0113 #define MAX_CROSSLINKS 16
0114
0115 typedef struct entry ENTRY;
0116
0117 typedef struct {
0118 char *name;
0119 ENTRY *link;
0120 long line;
0121 } ENTRY_USES;
0122
0123 struct entry {
0124 TERMTYPE2 tterm;
0125 unsigned nuses;
0126 ENTRY_USES uses[HARD_MAX_USES];
0127 int ncrosslinks;
0128 ENTRY *crosslinks[MAX_CROSSLINKS];
0129 long cstart;
0130 long cend;
0131 long startline;
0132 ENTRY *next;
0133 ENTRY *last;
0134 };
0135
0136 extern NCURSES_EXPORT_VAR(ENTRY *) _nc_head;
0137 extern NCURSES_EXPORT_VAR(ENTRY *) _nc_tail;
0138 #define for_entry_list(qp) for (qp = _nc_head; qp; qp = qp->next)
0139 #define for_entry_list2(qp,q0) for (qp = q0; qp; qp = qp->next)
0140
0141 #define MAX_LINE 132
0142
0143 #define NULLHOOK (bool(*)(ENTRY *))0
0144
0145
0146
0147
0148
0149 #define WANTED(s) ((s) == ABSENT_STRING)
0150 #define PRESENT(s) (((s) != ABSENT_STRING) && ((s) != CANCELLED_STRING))
0151
0152 #define ANDMISSING(p,q) \
0153 { \
0154 if (PRESENT(p) && !PRESENT(q)) \
0155 _nc_warning(#p " but no " #q); \
0156 }
0157
0158 #define PAIRED(p,q) \
0159 { \
0160 if (PRESENT(q) && !PRESENT(p)) \
0161 _nc_warning(#q " but no " #p); \
0162 if (PRESENT(p) && !PRESENT(q)) \
0163 _nc_warning(#p " but no " #q); \
0164 }
0165
0166
0167
0168
0169
0170
0171 extern NCURSES_EXPORT(ENTRY *) _nc_copy_entry (ENTRY *oldp);
0172 extern NCURSES_EXPORT(char *) _nc_save_str (const char *const);
0173 extern NCURSES_EXPORT(void) _nc_init_entry (ENTRY *const);
0174 extern NCURSES_EXPORT(void) _nc_merge_entry (ENTRY *const, ENTRY *const);
0175 extern NCURSES_EXPORT(void) _nc_wrap_entry (ENTRY *const, bool);
0176
0177
0178 extern NCURSES_EXPORT(void) _nc_align_termtype (TERMTYPE2 *, TERMTYPE2 *);
0179
0180
0181 extern NCURSES_EXPORT(void) _nc_free_termtype (TERMTYPE *);
0182 extern NCURSES_EXPORT(void) _nc_free_termtype1 (TERMTYPE *);
0183 extern NCURSES_EXPORT(void) _nc_free_termtype2 (TERMTYPE2 *);
0184
0185
0186 extern NCURSES_EXPORT(char *) _nc_trim_sgr0 (TERMTYPE2 *);
0187
0188
0189 #if NCURSES_XNAMES
0190 extern NCURSES_EXPORT_VAR(bool) _nc_user_definable;
0191 extern NCURSES_EXPORT_VAR(bool) _nc_disable_period;
0192 #endif
0193 extern NCURSES_EXPORT(int) _nc_parse_entry (ENTRY *, int, bool);
0194 extern NCURSES_EXPORT(int) _nc_capcmp (const char *, const char *);
0195
0196
0197 extern NCURSES_EXPORT(void) _nc_set_writedir (const char *);
0198 extern NCURSES_EXPORT(void) _nc_write_entry (TERMTYPE2 *const);
0199 extern NCURSES_EXPORT(int) _nc_write_object (TERMTYPE2 *, char *, unsigned *, unsigned);
0200
0201
0202 extern NCURSES_EXPORT(void) _nc_read_entry_source (FILE*, char*, int, bool, bool (*)(ENTRY*));
0203 extern NCURSES_EXPORT(bool) _nc_entry_match (char *, char *);
0204 extern NCURSES_EXPORT(int) _nc_resolve_uses (bool);
0205 extern NCURSES_EXPORT(int) _nc_resolve_uses2 (bool, bool);
0206 extern NCURSES_EXPORT(void) _nc_free_entries (ENTRY *);
0207 extern NCURSES_IMPEXP void (NCURSES_API *_nc_check_termtype)(TERMTYPE *);
0208 extern NCURSES_IMPEXP void (NCURSES_API *_nc_check_termtype2)(TERMTYPE2 *, bool);
0209
0210
0211 extern NCURSES_EXPORT(void) _nc_trace_xnames (TERMTYPE *);
0212
0213 #endif
0214
0215 #ifdef __cplusplus
0216 }
0217 #endif
0218
0219
0220
0221 #endif