X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Ftinfo%2Flib_options.c;h=cfce6c941051665976d789a445be9acf8c5a4811;hp=ae6b2c5b745f707d2bf731ee98c4c309c18ab2b2;hb=fc79b49bd8a9c5e4db287514cdac46e1691cf48a;hpb=9edffa2f21102c06dcf682d58b074c407bcedd0a diff --git a/ncurses/tinfo/lib_options.c b/ncurses/tinfo/lib_options.c index ae6b2c5b..cfce6c94 100644 --- a/ncurses/tinfo/lib_options.c +++ b/ncurses/tinfo/lib_options.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2006,2008 Free Software Foundation, Inc. * + * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -30,6 +30,7 @@ * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * * and: Thomas E. Dickey 1996-on * + * and: Juergen Pfeifer 2009 * ****************************************************************************/ /* @@ -43,7 +44,7 @@ #include -MODULE_ID("$Id: lib_options.c,v 1.55 2008/05/25 00:32:17 tom Exp $") +MODULE_ID("$Id: lib_options.c,v 1.60 2009/02/28 21:07:56 tom Exp $") static int _nc_curs_set(SCREEN *, int); static int _nc_meta(SCREEN *, bool); @@ -72,18 +73,26 @@ idcok(WINDOW *win, bool flag) } NCURSES_EXPORT(int) -halfdelay(int t) +NCURSES_SP_NAME(halfdelay) (NCURSES_SP_DCLx int t) { T((T_CALLED("halfdelay(%d)"), t)); - if (t < 1 || t > 255 || SP == 0) + if (t < 1 || t > 255 || SP_PARM == 0) returnCode(ERR); cbreak(); - SP->_cbreak = t + 1; + SP_PARM->_cbreak = t + 1; returnCode(OK); } +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +halfdelay(int t) +{ + return NCURSES_SP_NAME(halfdelay) (CURRENT_SCREEN, t); +} +#endif + NCURSES_EXPORT(int) nodelay(WINDOW *win, bool flag) { @@ -158,17 +167,25 @@ curs_set(int vis) } NCURSES_EXPORT(int) -typeahead(int fd) +NCURSES_SP_NAME(typeahead) (NCURSES_SP_DCLx int fd) { T((T_CALLED("typeahead(%d)"), fd)); - if (SP != 0) { - SP->_checkfd = fd; + if (SP_PARM != 0) { + SP_PARM->_checkfd = fd; returnCode(OK); } else { returnCode(ERR); } } +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +typeahead(int fd) +{ + return NCURSES_SP_NAME(typeahead) (CURRENT_SCREEN, fd); +} +#endif + /* ** has_key() ** @@ -204,8 +221,9 @@ has_key(int keycode) #undef CUR #define CUR (sp->_term)->type. -static int -_nc_putp(const char *name GCC_UNUSED, const char *value) +NCURSES_EXPORT(int) +NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_DCLx + const char *name GCC_UNUSED, const char *value) { int rc = ERR; @@ -216,8 +234,17 @@ _nc_putp(const char *name GCC_UNUSED, const char *value) return rc; } -static int -_nc_putp_flush(const char *name, const char *value) +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +_nc_putp(const char *name, const char *value) +{ + return NCURSES_SP_NAME(_nc_putp) (CURRENT_SCREEN, name, value); +} +#endif + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(_nc_putp_flush) (NCURSES_SP_DCLx + const char *name, const char *value) { int rc = _nc_putp(name, value); if (rc != ERR) { @@ -226,6 +253,14 @@ _nc_putp_flush(const char *name, const char *value) return rc; } +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +_nc_putp_flush(const char *name, const char *value) +{ + return NCURSES_SP_NAME(_nc_putp_flush) (CURRENT_SCREEN, name, value); +} +#endif + /* Turn the keypad on/off * * Note: we flush the output because changing this mode causes some terminals @@ -245,16 +280,16 @@ _nc_keypad(SCREEN *sp, bool flag) * has wgetch() reading in more than one thread. putp() and below * may use SP explicitly. */ - if (sp != SP) { + if (_nc_use_pthreads && sp != CURRENT_SCREEN) { SCREEN *save_sp; /* cannot use use_screen(), since that is not in tinfo library */ - _nc_lock_global(use_screen); - save_sp = SP; - SP = sp; + _nc_lock_global(curses); + save_sp = CURRENT_SCREEN; + _nc_set_screen(sp); rc = _nc_keypad(sp, flag); - SP = save_sp; - _nc_unlock_global(use_screen); + _nc_set_screen(save_sp); + _nc_unlock_global(curses); } else #endif { @@ -313,8 +348,8 @@ _nc_meta(SCREEN *sp, bool flag) /* Ok, we stay relaxed and don't signal an error if win is NULL */ - if (SP != 0) { - SP->_use_meta = flag; + if (sp != 0) { + sp->_use_meta = flag; if (flag) { _nc_putp("meta_on", meta_on);