]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/curses.priv.h
ncurses 6.0 - patch 20170617
[ncurses.git] / ncurses / curses.priv.h
index fe17d45cc7f7ff2e598a868722e37539be67a8d1..e4f62f6923a3ee5a18d67b4a1bb4064ad6974c2e 100644 (file)
@@ -34,7 +34,7 @@
  ****************************************************************************/
 
 /*
- * $Id: curses.priv.h,v 1.570 2017/04/12 00:50:57 tom Exp $
+ * $Id: curses.priv.h,v 1.575 2017/06/17 22:21:08 tom Exp $
  *
  *     curses.priv.h
  *
@@ -394,6 +394,11 @@ color_t;
 #define TerminalType(tp)     (tp)->type
 #endif
 
+#ifdef CUR
+#undef CUR
+#define CUR TerminalType(cur_term).
+#endif
+
 /*
  * Reduce dependency on cur_term global by using terminfo data from SCREEN's
  * pointer to this data.
@@ -402,7 +407,7 @@ color_t;
 #undef CUR
 #endif
 
-#define SP_TERMTYPE TerminalOf(sp)->type.
+#define SP_TERMTYPE TerminalType(TerminalOf(sp)).
 
 #include <term_entry.h>
 
@@ -787,6 +792,16 @@ typedef struct {
 
 #define TGETENT_MAX 4
 
+/*
+ * When converting from terminfo to termcap, check for cases where we can trim
+ * octal escapes down to 2-character form.  It is useful for terminfo format
+ * also, but not as important.
+ */
+#define MAX_TC_FIXUPS  10
+#define MIN_TC_FIXUPS  4
+
+#define isoctal(c) ((c) >= '0' && (c) <= '7')
+
 /*
  * State of tparm().
  */
@@ -1127,11 +1142,6 @@ struct screen {
        int             _pair_count;    /* same as COLOR_PAIRS               */
        int             _pair_limit;    /* actual limit of color-pairs       */
 #if NCURSES_EXT_FUNCS
-#if USE_NEW_PAIR
-       void            *_ordered_pairs; /* index used by alloc_pair()       */
-       int             _pairs_used;    /* actual number of color-pairs used */
-       int             _recent_pair;   /* number for most recent free-pair  */
-#endif
        bool            _assumed_color; /* use assumed colors                */
        bool            _default_color; /* use default colors                */
        bool            _has_sgr_39_49; /* has ECMA default color support    */
@@ -1292,6 +1302,11 @@ struct screen {
        bool            _screen_acs_fix;
        bool            _screen_unicode;
 #endif
+#if NCURSES_EXT_FUNCS && USE_NEW_PAIR
+       void            *_ordered_pairs; /* index used by alloc_pair()       */
+       int             _pairs_used;    /* actual number of color-pairs used */
+       int             _recent_pair;   /* number for most recent free-pair  */
+#endif
 };
 
 extern NCURSES_EXPORT_VAR(SCREEN *) _nc_screen_chain;
@@ -1908,6 +1923,14 @@ extern NCURSES_EXPORT(void) _nc_expanded (void);
 #define getcwd(buf,len) getwd(buf)
 #endif
 
+#define save_ttytype(termp) \
+       if (TerminalType(termp).term_names != 0) { \
+           _nc_STRNCPY(ttytype, \
+                       TerminalType(termp).term_names, \
+                       NAMESIZE - 1); \
+           ttytype[NAMESIZE - 1] = '\0'; \
+       }
+
 /* charable.c */
 #if USE_WIDEC_SUPPORT
 extern NCURSES_EXPORT(bool) _nc_is_charable(wchar_t);
@@ -2000,13 +2023,20 @@ extern NCURSES_EXPORT(void)   _nc_tinfo_cmdch(TERMINAL *, int);
 extern NCURSES_EXPORT(int)    _nc_ripoffline(int, int(*)(WINDOW*, int));
 
 /* lib_setup.c */
+#if NO_LEAKS
+#define ExitTerminfo(code)    _nc_free_tinfo(code)
+#else
+#define ExitTerminfo(code)    exit(code)
+#endif
+
 #define SETUP_FAIL ERR
+
 #define ret_error(code, fmt, arg)      if (errret) {\
                                            *errret = code;\
                                            returnCode(SETUP_FAIL);\
                                        } else {\
                                            fprintf(stderr, fmt, arg);\
-                                           exit(EXIT_FAILURE);\
+                                           ExitTerminfo(EXIT_FAILURE);\
                                        }
 
 #define ret_error1(code, fmt, arg)     ret_error(code, "'%s': " fmt, arg)
@@ -2016,7 +2046,7 @@ extern NCURSES_EXPORT(int)    _nc_ripoffline(int, int(*)(WINDOW*, int));
                                            returnCode(SETUP_FAIL);\
                                        } else {\
                                            fprintf(stderr, msg);\
-                                           exit(EXIT_FAILURE);\
+                                           ExitTerminfo(EXIT_FAILURE);\
                                        }
 
 /* lib_tstp.c */