X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Fbase%2Flib_color.c;h=ba2563c5e533d69072d000b8ed523d305a272dcf;hp=fa257b0a79fa4da0dc5cb1eb921c01348e1d2486;hb=0be808514502f3149b379d036ab3a83cbb4d4c02;hpb=82a087c4c47679fcfa59bb6d7bdbe587355ba3f6 diff --git a/ncurses/base/lib_color.c b/ncurses/base/lib_color.c index fa257b0a..ba2563c5 100644 --- a/ncurses/base/lib_color.c +++ b/ncurses/base/lib_color.c @@ -42,15 +42,28 @@ #include #include -MODULE_ID("$Id: lib_color.c,v 1.83 2007/02/03 23:10:06 tom Exp $") +MODULE_ID("$Id: lib_color.c,v 1.84 2007/03/10 19:20:15 tom Exp $") /* * These should be screen structure members. They need to be globals for * historical reasons. So we assign them in start_color() and also in * set_term()'s screen-switching logic. */ +#if USE_REENTRANT +NCURSES_EXPORT(int) +NCURSES_PUBLIC_VAR(COLOR_PAIRS) (void) +{ + return SP ? SP->_pair_count : -1; +} +NCURSES_EXPORT(int) +NCURSES_PUBLIC_VAR(COLORS) (void) +{ + return SP ? SP->_color_count : -1; +} +#else NCURSES_EXPORT_VAR(int) COLOR_PAIRS = 0; NCURSES_EXPORT_VAR(int) COLORS = 0; +#endif #define DATA(r,g,b) {r,g,b, 0,0,0, 0} @@ -239,8 +252,12 @@ start_color(void) } if (max_pairs > 0 && max_colors > 0) { - COLOR_PAIRS = SP->_pair_count = max_pairs; - COLORS = SP->_color_count = max_colors; + SP->_pair_count = max_pairs; + SP->_color_count = max_colors; +#if !USE_REENTRANT + COLOR_PAIRS = max_pairs; + COLORS = max_colors; +#endif if ((SP->_color_pairs = TYPE_CALLOC(colorpair_t, max_pairs)) != 0) {