X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Fcurses.priv.h;h=a72555c158d7cd51f18a210b9d4485cf1746adf3;hp=0889a341858de0a595345ea736201a356829db7a;hb=HEAD;hpb=122d3739b3c11c83decc625d53f26fff6e825710 diff --git a/ncurses/curses.priv.h b/ncurses/curses.priv.h index 0889a341..6d0dbcdf 100644 --- a/ncurses/curses.priv.h +++ b/ncurses/curses.priv.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2022,2023 Thomas E. Dickey * + * Copyright 2018-2023,2024 Thomas E. Dickey * * Copyright 1998-2017,2018 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -35,7 +35,7 @@ ****************************************************************************/ /* - * $Id: curses.priv.h,v 1.677 2023/11/10 15:11:11 tom Exp $ + * $Id: curses.priv.h,v 1.689 2024/05/11 19:05:45 tom Exp $ * * curses.priv.h * @@ -72,12 +72,6 @@ extern "C" { #include #endif -#if HAVE_LIMITS_H -# include -#elif HAVE_SYS_PARAM_H -# include -#endif - #include #include @@ -89,16 +83,6 @@ extern "C" { # endif #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 - #if DECL_ERRNO extern int errno; #endif @@ -151,6 +135,7 @@ extern int errno; #ifndef PRIxPTR # define PRIxPTR "lx" +# undef CASTxPTR # define CASTxPTR(n) (long)(void*)(n) #endif @@ -891,6 +876,12 @@ typedef int (*TYPE_Gpm_GetEvent) (Gpm_Event *); */ #define MAX_DELAY_MSECS 30000 +/* + * Limit screen dimensions read from environment variables. + */ +#define MAX_ENV_LINES 512 +#define MAX_ENV_COLUMNS 512 + /* * 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 @@ -921,6 +912,7 @@ typedef int (*TYPE_Gpm_GetEvent) (Gpm_Event *); * string is less than 80 columns, but this buffer size is an absolute * limit. */ +#define TRACECHR_BUF 40 #define TRACEMSE_MAX (80 + (5 * 10) + (32 * 15)) #define TRACEMSE_FMT "id %2d at (%2d, %2d, %2d) state %4lx = {" /* } */ @@ -1251,7 +1243,7 @@ typedef struct screen { #endif #ifdef TRACE - char tracechr_buf[40]; + char tracechr_buf[TRACECHR_BUF]; char tracemse_buf[TRACEMSE_MAX]; #if USE_REENTRANT long _outchars; @@ -1378,10 +1370,6 @@ extern NCURSES_EXPORT_VAR(SIG_ATOMIC_T) _nc_have_sigwinch; #define TR_PUTC(c) TR(TRACE_CHARPUT, ("PUTC %#x", UChar(c))) -#ifndef MB_LEN_MAX -#define MB_LEN_MAX 16 /* should be >= MB_CUR_MAX, but that may be a function */ -#endif - #if USE_WIDEC_SUPPORT /* { */ /* true if the status/errno indicate an illegal multibyte sequence */ #define isEILSEQ(status) (((size_t)status == (size_t)-1) && (errno == EILSEQ)) @@ -1394,7 +1382,20 @@ extern NCURSES_EXPORT_VAR(SIG_ATOMIC_T) _nc_have_sigwinch; #define NulColor /* nothing */ #endif -#define NulChar 0,0,0,0 /* FIXME: see CCHARW_MAX */ +#if CCHARW_MAX > 6 +#define NulChar 0,0,0,0,0 +#elif CCHARW_MAX > 5 +#define NulChar 0,0,0,0 /* ncurses7 */ +#elif CCHARW_MAX > 4 +#define NulChar 0,0,0 /* ncurses6 */ +#elif CCHARW_MAX > 3 +#define NulChar 0,0 +#elif CCHARW_MAX > 2 +#define NulChar 0 +#else +#define NulChar /* nothing */ +#endif + #define CharOf(c) ((c).chars[0]) #define AttrOf(c) ((c).attr) @@ -1405,16 +1406,12 @@ extern NCURSES_EXPORT_VAR(SIG_ATOMIC_T) _nc_have_sigwinch; #define NewChar2(c,a) { a, { c, NulChar } NulColor } #define NewChar(ch) NewChar2(ChCharOf(ch), ChAttrOf(ch)) -#if CCHARW_MAX == 5 +#if CCHARW_MAX > 1 #define CharEq(a,b) (((a).attr == (b).attr) \ - && (a).chars[0] == (b).chars[0] \ - && (a).chars[1] == (b).chars[1] \ - && (a).chars[2] == (b).chars[2] \ - && (a).chars[3] == (b).chars[3] \ - && (a).chars[4] == (b).chars[4] \ + && !memcmp((a).chars, \ + (b).chars, \ + CCHARW_MAX * sizeof((b).chars[0])) \ if_EXT_COLORS(&& (a).ext_color == (b).ext_color)) -#elif CCHARW_MAX > 0 -#error Inconsistent values for CCHARW_MAX #else #define CharEq(a,b) (!memcmp(&(a), &(b), sizeof(a))) #endif @@ -2259,7 +2256,7 @@ extern int __MINGW_NOTHROW _nc_mblen(const char *, size_t); #if defined(_NC_WINDOWS) || defined(_NC_MINGW) /* see wcwidth.c */ -extern NCURSES_EXPORT(int) mk_wcwidth(wchar_t); +extern NCURSES_EXPORT(int) mk_wcwidth(uint32_t); #define wcwidth(ucs) _nc_wcwidth(ucs) #endif @@ -2540,6 +2537,14 @@ extern NCURSES_EXPORT_VAR(TERM_DRIVER) _nc_TINFO_DRIVER; #define NC_ISATTY(fd) isatty(fd) #endif +/* + * Perhaps not "real" but possibly not "fake". + */ +#define IsRealTty(fd,value) \ + (NC_ISATTY(fd) \ + && (value = ttyname(fd)) != NULL \ + && strncmp(value, "/dev/pts/", 9)) + #ifdef USE_TERM_DRIVER # define IsTermInfo(sp) ((TCBOf(sp) != 0) && ((TCBOf(sp)->drv->isTerminfo))) # define HasTInfoTerminal(sp) ((0 != TerminalOf(sp)) && IsTermInfo(sp))