]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/term.priv.h
ncurses 6.4 - patch 20240420
[ncurses.git] / ncurses / term.priv.h
index ce7a986bd9edb50e507c88f635985187f5144ffc..1f436b5f8254fb80a6ba7d598ad6d447ac7a45cb 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright 2021 Thomas E. Dickey                                          *
+ * Copyright 2021-2023,2024 Thomas E. Dickey                                *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
  ****************************************************************************/
 
 /*
- * $Id: term.priv.h,v 1.6 2021/09/26 20:43:08 tom Exp $
+ * $Id: term.priv.h,v 1.13 2024/03/02 20:43:06 tom Exp $
  *
  *     term.priv.h
  *
  *     Header file for terminfo library objects which are private to
  *     the library.
- *
  */
 
 #ifndef _TERM_PRIV_H
@@ -46,11 +45,20 @@ extern "C" {
 
 #include <ncurses_cfg.h>
 
+#ifndef __NCURSES_H
+#include <curses.h>
+#endif
+
 #undef NCURSES_OPAQUE
 #define NCURSES_INTERNALS 1
 #define NCURSES_OPAQUE 0
 
-#include <limits.h>            /* PATH_MAX */
+#if HAVE_LIMITS_H
+# include <limits.h>           /* PATH_MAX, MB_LEN_MAX, etc */
+#elif HAVE_SYS_PARAM_H
+# include <sys/param.h>
+#endif
+
 #include <signal.h>            /* sig_atomic_t */
 #include <time.h>              /* time_t */
 #include <term.h>              /* time_t */
@@ -61,6 +69,28 @@ extern "C" {
 #endif
 #endif
 
+/*
+ * If not properly configured to use the system's limits.h, we get gcc's
+ * fallback for limits.h which sets MB_LEN_MAX to 1, which is never correct.
+ */
+#if !HAVE_CONSISTENT_MB_LEN_MAX
+#undef MB_LEN_MAX
+#endif
+
+#ifndef MB_LEN_MAX
+#define MB_LEN_MAX 16  /* should be >= MB_CUR_MAX, but that may be a function */
+#endif
+
+#ifndef PATH_MAX
+# if defined(_POSIX_PATH_MAX)
+#  define PATH_MAX _POSIX_PATH_MAX
+# elif defined(MAXPATHLEN)
+#  define PATH_MAX MAXPATHLEN
+# else
+#  define PATH_MAX 255 /* the Posix minimum path-size */
+# endif
+#endif
+
 /*
  * State of tparm().
  */
@@ -185,6 +215,7 @@ typedef struct {
        TGETENT_CACHE   tgetent_cache[TGETENT_MAX];
        int             tgetent_index;
        long            tgetent_sequence;
+       int             terminal_count;
 
        char *          dbd_blob;       /* string-heap for dbd_list[] */
        char **         dbd_list;       /* distinct places to look for data */
@@ -237,7 +268,6 @@ typedef struct {
 
 #ifdef TRACE
        bool            trace_opened;
-       char            trace_fname[PATH_MAX];
        int             trace_level;
        FILE *          trace_fp;
        int             trace_fd;
@@ -323,6 +353,8 @@ typedef struct {
 
 extern NCURSES_EXPORT_VAR(NCURSES_PRESCREEN) _nc_prescreen;
 
+extern NCURSES_EXPORT(void) _nc_free_tparm(TERMINAL*);
+
 #ifdef __cplusplus
 }
 #endif