I've a feeling I'm being stupid here,  but...

   The Fine Manual tells me,  at

https://invisible-island.net/ncurses/man/new_pair.3x.html

that the find_pair(), alloc_pair(), free_pair() functions are "specific to ncurses... It is recommended that any code depending on them be conditioned using NCURSES_VERSION."

However, it doesn't say with which version this was added. It'd help if the above said something along the lines of "should be conditioned on NCURSES_VERSION >= 5", or something like that (dunno with which version it was introduced, or if indeed the presence of the functions can be determined that way.)

I have a few test programs that use these functions, both with ncurses and PDCursesMod/PDCurses (both of which also supply these functions). I'd like to have those programs start with, say,

#if defined( __PDCURSES__) || NCURSES_VERSION >= 5
(we've got the functions;  main body of test code)
#else
void main( void)
{
    fputs( stderr, "Sorry,  no new_pair() functions\n");
}
#endif

More generally, it'd be nice to be able to test for the availability of the various ncurses extensions when compiling.

If one has the ncurses sources, you can look in ncurses_cfg.h for HAVE_ALLOC_PAIR. (Which is what the ncurses demos use.) But I'd like a solution that would work for the more common case where the libraries and headers are installed, but not the source.

Thank you,       -- Bill

Reply via email to