+ continue integrating "sp-funcs" by Juergen Pfeifer (incomplete).
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
-------------------------------------------------------------------------------
--- $Id: NEWS,v 1.1392 2009/05/30 19:19:59 tom Exp $
+-- $Id: NEWS,v 1.1393 2009/06/06 21:41:06 tom Exp $
-------------------------------------------------------------------------------
This is a log of changes that ncurses has gone through since Zeyd started
Changes through 1.9.9e did not credit all contributions;
it is not possible to add this information.
+20090606
+ + continue integrating "sp-funcs" by Juergen Pfeifer (incomplete).
+
20090530
+ fix an infinite recursion when adding a legacy-coding 8-bit value
using insch() (report by Clemens Ladisch).
# use or other dealings in this Software without prior written #
# authorization. #
##############################################################################
-# $Id: dist.mk,v 1.702 2009/05/30 13:36:52 tom Exp $
+# $Id: dist.mk,v 1.703 2009/06/06 15:37:29 tom Exp $
# Makefile for creating ncurses distributions.
#
# This only needs to be used directly as a makefile by developers, but
# These define the major/minor/patch versions of ncurses.
NCURSES_MAJOR = 5
NCURSES_MINOR = 7
-NCURSES_PATCH = 20090530
+NCURSES_PATCH = 20090606
# We don't append the patch to the version, since this only applies to releases
VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
#include <curses.priv.h>
-MODULE_ID("$Id: keyok.c,v 1.8 2009/02/15 00:31:38 tom Exp $")
+MODULE_ID("$Id: keyok.c,v 1.9 2009/06/06 19:24:57 tom Exp $")
/*
* Enable (or disable) ncurses' interpretation of a keycode by adding (or
NCURSES_SP_NAME(keyok) (NCURSES_SP_DCLx int c, bool flag)
{
int code = ERR;
- int count = 0;
- char *s;
+ T((T_CALLED("keyok(%p, %d,%d)"), SP_PARM, c, flag));
+#ifdef USE_TERM_DRIVER
+ code = CallDriver_2(sp, kyOk, c, flag);
+#else
T((T_CALLED("keyok(%d,%d)"), c, flag));
if (c >= 0) {
+ int count = 0;
+ char *s;
unsigned ch = (unsigned) c;
+
if (flag) {
while ((s = _nc_expand_try(SP_PARM->_key_ok, ch, &count, 0)) != 0
&& _nc_remove_key(&(SP_PARM->_key_ok), ch)) {
}
}
}
+#endif
returnCode(code);
}
#include <tic.h>
#ifndef CUR
-#define CUR SP_TERMTYPE
+#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: lib_color.c,v 1.91 2009/05/10 00:48:29 tom Exp $")
+MODULE_ID("$Id: lib_color.c,v 1.92 2009/06/06 20:26:16 tom Exp $")
/*
* These should be screen structure members. They need to be globals for
tp = (hue_lightness_saturation) ? hls_palette : cga_palette;
for (n = 0; n < COLORS; n++) {
if (InPalette(n)) {
- SP->_color_table[n] = tp[n];
+ SP_PARM->_color_table[n] = tp[n];
} else {
- SP->_color_table[n] = tp[n % MAX_PALETTE];
+ SP_PARM->_color_table[n] = tp[n % MAX_PALETTE];
if (hue_lightness_saturation) {
- SP->_color_table[n].green = 100;
+ SP_PARM->_color_table[n].green = 100;
} else {
- if (SP->_color_table[n].red)
- SP->_color_table[n].red = 1000;
- if (SP->_color_table[n].green)
- SP->_color_table[n].green = 1000;
- if (SP->_color_table[n].blue)
- SP->_color_table[n].blue = 1000;
+ if (SP_PARM->_color_table[n].red)
+ SP_PARM->_color_table[n].red = 1000;
+ if (SP_PARM->_color_table[n].green)
+ SP_PARM->_color_table[n].green = 1000;
+ if (SP_PARM->_color_table[n].blue)
+ SP_PARM->_color_table[n].blue = 1000;
}
}
}
* someone has changed the color definitions.
*/
bool
-_nc_reset_colors(void)
-{
-#if NCURSES_SP_FUNCS
- SCREEN *sp = CURRENT_SCREEN;
-#endif
+NCURSES_SP_NAME(_nc_reset_colors) (NCURSES_SP_DCL0) {
int result = FALSE;
T((T_CALLED("_nc_reset_colors()")));
- if (SP->_color_defs > 0)
- SP->_color_defs = -(SP->_color_defs);
+ if (SP_PARM->_color_defs > 0)
+ SP_PARM->_color_defs = -(SP_PARM->_color_defs);
if (reset_color_pair(NCURSES_SP_ARG))
result = TRUE;
returnBool(result);
}
+#if NCURSES_SP_FUNCS
+bool
+_nc_reset_colors(void)
+{
+ return NCURSES_SP_NAME(_nc_reset_colors) (CURRENT_SCREEN);
+}
+#endif
+
NCURSES_EXPORT(int)
NCURSES_SP_NAME(start_color) (NCURSES_SP_DCL0)
{
TPARM_1(set_color_pair, pair),
1, outc);
return;
- } else if (SP != 0) {
+ } else if (SP_PARM != 0) {
pair_content((short) pair, &fg, &bg);
}
}
if (old_pair >= 0
- && SP != 0
+ && SP_PARM != 0
&& pair_content(old_pair, &old_fg, &old_bg) != ERR) {
if ((isDefaultColor(fg) && !isDefaultColor(old_fg))
|| (isDefaultColor(bg) && !isDefaultColor(old_bg))) {
* the terminal description, treat it as screen's indicator of ECMA
* SGR 39 and SGR 49, and assume the two sequences are independent.
*/
- if (SP->_has_sgr_39_49
+ if (SP_PARM->_has_sgr_39_49
&& isDefaultColor(old_bg)
&& !isDefaultColor(old_fg)) {
NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx "\033[39m", 1, outc);
- } else if (SP->_has_sgr_39_49
+ } else if (SP_PARM->_has_sgr_39_49
&& isDefaultColor(old_fg)
&& !isDefaultColor(old_bg)) {
NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx "\033[49m", 1, outc);
/****************************************************************************
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ * and: Thomas E. Dickey 1996-on *
+ * and: Juergen Pfeifer *
****************************************************************************/
/*
#include <curses.priv.h>
-MODULE_ID("$Id: lib_mvwin.c,v 1.15 2009/04/18 18:25:37 tom Exp $")
+MODULE_ID("$Id: lib_mvwin.c,v 1.16 2009/06/06 20:25:07 tom Exp $")
NCURSES_EXPORT(int)
mvwin(WINDOW *win, int by, int bx)
{
+#if NCURSES_SP_FUNCS
+ SCREEN *sp = _nc_screen_of(win);
+#endif
+
T((T_CALLED("mvwin(%p,%d,%d)"), win, by, bx));
if (!win || (win->_flags & _ISPAD))
}
#endif
- if (by + win->_maxy > screen_lines(CURRENT_SCREEN) - 1
- || bx + win->_maxx > screen_columns(CURRENT_SCREEN) - 1
+ if (by + win->_maxy > screen_lines(SP_PARM) - 1
+ || bx + win->_maxx > screen_columns(SP_PARM) - 1
|| by < 0
|| bx < 0)
returnCode(ERR);
#include <curses.priv.h>
#include <stddef.h>
-MODULE_ID("$Id: lib_newwin.c,v 1.57 2009/05/09 23:40:03 tom Exp $")
+MODULE_ID("$Id: lib_newwin.c,v 1.58 2009/06/06 17:53:11 tom Exp $")
#define window_is(name) ((sp)->_##name == win)
* internally, and it is useful to allow those to be invoked without switching
* SCREEN's, e.g., for multi-threaded applications.
*/
-NCURSES_EXPORT(SCREEN *)
-_nc_screen_of(WINDOW *win)
-{
- SCREEN *sp = 0;
-
- if (win != 0) {
- WINDOWLIST *wp = (WINDOWLIST *) win;
- sp = wp->screen;
- }
- return (sp);
-}
-
#if NCURSES_SP_FUNCS
NCURSES_EXPORT(WINDOW *)
_nc_curscr_of(SCREEN *sp)
/****************************************************************************
- * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2007,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 *
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
* and: Thomas E. Dickey 1996-on *
+ * and: Juergen Pfeifer *
****************************************************************************/
/*
#include <curses.priv.h>
-MODULE_ID("$Id: lib_refresh.c,v 1.41 2007/09/29 20:39:34 tom Exp $")
+MODULE_ID("$Id: lib_refresh.c,v 1.42 2009/06/06 20:27:39 tom Exp $")
NCURSES_EXPORT(int)
wrefresh(WINDOW *win)
{
int code;
+#if NCURSES_SP_FUNCS
+ SCREEN *SP_PARM = _nc_screen_of(win);
+#endif
T((T_CALLED("wrefresh(%p)"), win));
if (win == 0) {
code = ERR;
- } else if (win == curscr) {
- curscr->_clear = TRUE;
- code = doupdate();
+ } else if (win == CurScreen(SP_PARM)) {
+ CurScreen(SP_PARM)->_clear = TRUE;
+ code = NCURSES_SP_NAME(doupdate) (NCURSES_SP_ARG);
} else if ((code = wnoutrefresh(win)) == OK) {
if (win->_clear)
- newscr->_clear = TRUE;
- code = doupdate();
+ NewScreen(SP_PARM)->_clear = TRUE;
+ code = NCURSES_SP_NAME(doupdate) (NCURSES_SP_ARG);
/*
* Reset the clearok() flag in case it was set for the special
* case in hardscroll.c (if we don't reset it here, we'll get 2
#if USE_SCROLL_HINTS
bool wide;
#endif
+#if NCURSES_SP_FUNCS
+ SCREEN *SP_PARM = _nc_screen_of(win);
+#endif
T((T_CALLED("wnoutrefresh(%p)"), win));
#ifdef TRACE
begx = win->_begx;
begy = win->_begy;
- newscr->_nc_bkgd = win->_nc_bkgd;
- WINDOW_ATTRS(newscr) = WINDOW_ATTRS(win);
+ NewScreen(SP_PARM)->_nc_bkgd = win->_nc_bkgd;
+ WINDOW_ATTRS(NewScreen(SP_PARM)) = WINDOW_ATTRS(win);
/* merge in change information from all subwindows of this window */
wsyncdown(win);
* windows). Note that changing this formula will not break any code,
* merely change the costs of various update cases.
*/
- wide = (begx <= 1 && win->_maxx >= (newscr->_maxx - 1));
+ wide = (begx <= 1 && win->_maxx >= (NewScreen(SP_PARM)->_maxx - 1));
#endif
win->_flags &= ~_HASMOVED;
/* limit(dst_col) */
limit_x = win->_maxx;
/* limit(src_col) */
- if (limit_x > newscr->_maxx - begx)
- limit_x = newscr->_maxx - begx;
+ if (limit_x > NewScreen(SP_PARM)->_maxx - begx)
+ limit_x = NewScreen(SP_PARM)->_maxx - begx;
for (src_row = 0, dst_row = begy + win->_yoffset;
- src_row <= win->_maxy && dst_row <= newscr->_maxy;
+ src_row <= win->_maxy && dst_row <= NewScreen(SP_PARM)->_maxy;
src_row++, dst_row++) {
- register struct ldat *nline = &newscr->_line[dst_row];
+ register struct ldat *nline = &(NewScreen(SP_PARM)->_line[dst_row]);
register struct ldat *oline = &win->_line[src_row];
if (oline->firstchar != _NOCHANGE) {
* this character. Find the end of the character.
*/
++j;
- while (j <= newscr->_maxx && isWidecExt(nline->text[j])) {
+ while (j <= NewScreen(SP_PARM)->_maxx &&
+ isWidecExt(nline->text[j])) {
fix_right = j++;
}
}
if (win->_clear) {
win->_clear = FALSE;
- newscr->_clear = TRUE;
+ NewScreen(SP_PARM)->_clear = TRUE;
}
if (!win->_leaveok) {
- newscr->_cury = win->_cury + win->_begy + win->_yoffset;
- newscr->_curx = win->_curx + win->_begx;
+ NewScreen(SP_PARM)->_cury = win->_cury + win->_begy + win->_yoffset;
+ NewScreen(SP_PARM)->_curx = win->_curx + win->_begx;
}
- newscr->_leaveok = win->_leaveok;
+ NewScreen(SP_PARM)->_leaveok = win->_leaveok;
#ifdef TRACE
if (USE_TRACEF(TRACE_UPDATE)) {
- _tracedump("newscr", newscr);
+ _tracedump("newscr", NewScreen(SP_PARM));
_nc_unlock_global(tracef);
}
#endif /* TRACE */
#include <curses.priv.h>
#ifndef CUR
-#define CUR SP_TERMTYPE
+#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: lib_screen.c,v 1.34 2009/05/10 00:48:29 tom Exp $")
+MODULE_ID("$Id: lib_screen.c,v 1.35 2009/06/06 20:26:17 tom Exp $")
#define MAX_SIZE 0x3fff /* 16k is big enough for a window or pad */
NCURSES_EXPORT(WINDOW *)
-getwin(FILE *filep)
+NCURSES_SP_NAME(getwin) (NCURSES_SP_DCLx FILE *filep)
{
WINDOW tmp, *nwin;
int n;
returnWin(0);
if (tmp._flags & _ISPAD) {
- nwin = newpad(tmp._maxy + 1, tmp._maxx + 1);
+ nwin = NCURSES_SP_NAME(newpad) (NCURSES_SP_ARGx
+ tmp._maxy + 1, tmp._maxx + 1);
} else {
- nwin = newwin(tmp._maxy + 1, tmp._maxx + 1, 0, 0);
+ nwin = NCURSES_SP_NAME(newwin) (NCURSES_SP_ARGx
+ tmp._maxy + 1,
+ tmp._maxx + 1, 0, 0);
}
/*
returnWin(nwin);
}
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(WINDOW *)
+getwin(FILE *filep)
+{
+ return NCURSES_SP_NAME(getwin) (CURRENT_SCREEN, filep);
+}
+#endif
+
NCURSES_EXPORT(int)
putwin(WINDOW *win, FILE *filep)
{
{
FILE *fp = 0;
- T((T_CALLED("scr_restore(%s)"), _nc_visbuf(file)));
+ T((T_CALLED("scr_restore(%p,%s)"), SP_PARM, _nc_visbuf(file)));
if (_nc_access(file, R_OK) < 0
|| (fp = fopen(file, "rb")) == 0) {
returnCode(ERR);
} else {
- delwin(newscr);
- SP_PARM->_newscr = getwin(fp);
+ delwin(NewScreen(SP_PARM));
+ NewScreen(SP_PARM) = getwin(fp);
#if !USE_REENTRANT
- newscr = SP_PARM->_newscr;
+ newscr = NewScreen(SP_PARM);
#endif
(void) fclose(fp);
returnCode(OK);
NCURSES_SP_NAME(scr_init) (NCURSES_SP_DCLx const char *file)
{
FILE *fp = 0;
+ int code = ERR;
- T((T_CALLED("scr_init(%s)"), _nc_visbuf(file)));
-
- if (exit_ca_mode && non_rev_rmcup)
- returnCode(ERR);
+ T((T_CALLED("scr_init(%p,%s)"), SP_PARM, _nc_visbuf(file)));
- if (_nc_access(file, R_OK) < 0
- || (fp = fopen(file, "rb")) == 0) {
- returnCode(ERR);
- } else {
- delwin(curscr);
- SP_PARM->_curscr = getwin(fp);
+ if (SP_PARM != 0 &&
+#ifdef USE_TERM_DRIVER
+ InfoOf(SP_PARM).caninit
+#else
+ !(exit_ca_mode && non_rev_rmcup)
+#endif
+ ) {
+ if (_nc_access(file, R_OK) >= 0
+ && (fp = fopen(file, "rb")) != 0) {
+ delwin(CurScreen(SP_PARM));
+ CurScreen(SP_PARM) = getwin(fp);
#if !USE_REENTRANT
- curscr = SP_PARM->_curscr;
+ curscr = CurScreen(SP_PARM);
#endif
- (void) fclose(fp);
- returnCode(OK);
+ (void) fclose(fp);
+ code = OK;
+ }
}
+ returnCode(code);
}
#if NCURSES_SP_FUNCS
NCURSES_EXPORT(int)
NCURSES_SP_NAME(scr_set) (NCURSES_SP_DCLx const char *file)
{
- T((T_CALLED("scr_set(%s)"), _nc_visbuf(file)));
+ T((T_CALLED("scr_set(%p,%s)"), SP_PARM, _nc_visbuf(file)));
- if (scr_init(file) == ERR) {
+ if (NCURSES_SP_NAME(scr_init) (NCURSES_SP_ARGx file) == ERR) {
returnCode(ERR);
} else {
- delwin(newscr);
- SP_PARM->_newscr = dupwin(curscr);
+ delwin(NewScreen(SP_PARM));
+ NewScreen(SP_PARM) = dupwin(curscr);
#if !USE_REENTRANT
- newscr = SP_PARM->_newscr;
+ newscr = NewScreen(SP_PARM);
#endif
returnCode(OK);
}
#include <tic.h>
#ifndef CUR
-#define CUR SP_TERMTYPE
+#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: lib_set_term.c,v 1.122 2009/05/10 00:48:29 tom Exp $")
+MODULE_ID("$Id: lib_set_term.c,v 1.123 2009/06/06 20:26:17 tom Exp $")
NCURSES_EXPORT(SCREEN *)
set_term(SCREEN *screenp)
curscr = SP->_curscr;
#endif
#if USE_SIZECHANGE
- SP->_resize = resizeterm;
+ SP->_resize = NCURSES_SP_NAME(resizeterm);
#endif
newscr->_clear = TRUE;
* Write SLK window to the (virtual) screen.
*/
#include <curses.priv.h>
-#include <term.h> /* num_labels, label_*, plab_norm */
#ifndef CUR
-#define CUR SP_TERMTYPE
+#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: lib_slkrefr.c,v 1.20 2009/05/10 00:48:29 tom Exp $")
+MODULE_ID("$Id: lib_slkrefr.c,v 1.21 2009/06/06 20:26:17 tom Exp $")
/*
* Paint the info line for the PC style SLK emulation.
* Write the soft labels to the soft-key window.
*/
static void
-slk_intern_refresh(SLK * slk)
+slk_intern_refresh(SCREEN *sp)
{
-#if NCURSES_SP_FUNCS
- SCREEN *sp = CURRENT_SCREEN;
-#endif
int i;
- int fmt = SP->slk_format;
+ int fmt;
+ SLK *slk;
+ int numlab;
+
+ if (sp == 0)
+ return;
+
+ slk = sp->_slk;
+ fmt = sp->slk_format;
+ numlab = InfoOf(sp).numlabels;
+
+ if (slk->hidden)
+ return;
for (i = 0; i < slk->labcnt; i++) {
if (slk->dirty || slk->ent[i].dirty) {
if (slk->ent[i].visible) {
- if (num_labels > 0 && SLK_STDFMT(fmt)) {
+ if (numlab > 0 && SLK_STDFMT(fmt)) {
+#ifdef USE_TERM_DRIVER
+ CallDriver_2(sp, hwlabel, i + 1, slk->ent[i].form_text);
+#else
if (i < num_labels) {
TPUTS_TRACE("plab_norm");
putp(TPARM_2(plab_norm, i + 1, slk->ent[i].form_text));
}
+#endif
} else {
if (fmt == 4)
slk_paint_info(slk->win);
wmove(slk->win, SLK_LINES(fmt) - 1, slk->ent[i].ent_x);
- if (SP->_slk) {
- wattrset(slk->win, AttrOf(SP->_slk->attr));
+ if (sp->_slk) {
+ wattrset(slk->win, AttrOf(sp->_slk->attr));
}
waddstr(slk->win, slk->ent[i].form_text);
/* if we simulate SLK's, it's looking much more
natural to use the current ATTRIBUTE also
for the label window */
- wattrset(slk->win, WINDOW_ATTRS(stdscr));
+ wattrset(slk->win, WINDOW_ATTRS(StdScreen(sp)));
}
}
slk->ent[i].dirty = FALSE;
}
slk->dirty = FALSE;
- if (num_labels > 0) {
+ if (numlab > 0) {
+#ifdef USE_TERM_DRIVER
+ CallDriver_1(sp, hwlabelOnOff, slk->hidden ? FALSE : TRUE);
+#else
if (slk->hidden) {
TPUTS_TRACE("label_off");
putp(label_off);
TPUTS_TRACE("label_on");
putp(label_on);
}
+#endif
}
}
NCURSES_EXPORT(int)
NCURSES_SP_NAME(slk_noutrefresh) (NCURSES_SP_DCL0)
{
- T((T_CALLED("slk_noutrefresh()")));
+ T((T_CALLED("slk_noutrefresh(%p)"), SP_PARM));
- if (SP_PARM == NULL || SP_PARM->_slk == NULL)
+ if (SP_PARM == 0 || SP_PARM->_slk == 0)
returnCode(ERR);
if (SP_PARM->_slk->hidden)
returnCode(OK);
- slk_intern_refresh(SP_PARM->_slk);
+ slk_intern_refresh(SP_PARM);
returnCode(wnoutrefresh(SP_PARM->_slk->win));
}
NCURSES_EXPORT(int)
NCURSES_SP_NAME(slk_refresh) (NCURSES_SP_DCL0)
{
- T((T_CALLED("slk_refresh()")));
+ T((T_CALLED("slk_refresh(%p)"), SP_PARM));
- if (SP_PARM == NULL || SP_PARM->_slk == NULL)
+ if (SP_PARM == 0 || SP_PARM->_slk == 0)
returnCode(ERR);
if (SP_PARM->_slk->hidden)
returnCode(OK);
- slk_intern_refresh(SP_PARM->_slk);
+ slk_intern_refresh(SP_PARM);
returnCode(wrefresh(SP_PARM->_slk->win));
}
/*
- * $Id: curses.priv.h,v 1.420 2009/05/30 15:53:46 tom Exp $
+ * $Id: curses.priv.h,v 1.421 2009/06/06 18:12:52 tom Exp $
*
* curses.priv.h
*
#endif
#else /* !(NCURSES_EXT_COLORS && USE_WIDEC_SUPPORT) */
+
#define if_EXT_COLORS(stmt) /* nothing */
#define SetPair(value,p) RemAttr(value, A_COLOR), \
SetAttr(value, AttrOf(value) | (A_COLOR & COLOR_PAIR(p)))
*/
bool _nc_sp_idlok;
bool _nc_sp_idcok;
+
#define _nc_idlok SP->_nc_sp_idlok
#define _nc_idcok SP->_nc_sp_idcok
* This supports automatic resizing
*/
#if USE_SIZECHANGE
- int (*_resize)(int,int);
+ int (*_resize)(NCURSES_SP_DCLx int y, int x);
#endif
/*
* On systems with a broken linker, define 'SP' as a function to force the
* linker to pull in the data-only module with 'SP'.
*/
+#define _nc_alloc_screen_sp() typeCalloc(SCREEN, 1)
+
#if BROKEN_LINKER
-#define SP _nc_screen()
extern NCURSES_EXPORT(SCREEN *) _nc_screen (void);
extern NCURSES_EXPORT(int) _nc_alloc_screen (void);
extern NCURSES_EXPORT(void) _nc_set_screen (SCREEN *);
/* current screen is private data; avoid possible linking conflicts too */
extern NCURSES_EXPORT_VAR(SCREEN *) SP;
#define CURRENT_SCREEN SP
-#define _nc_alloc_screen() ((SP = typeCalloc(SCREEN, 1)) != 0)
+#define _nc_alloc_screen() ((SP = _nc_alloc_screen_sp()) != 0)
#define _nc_set_screen(sp) SP = sp
#endif
* We put the safe versions of various calls here as they are not published
* part of the API up to now
*/
-extern NCURSES_EXPORT(SCREEN*) _nc_SP(void);
-
-extern NCURSES_EXPORT(TERMINAL*) NCURSES_SP_NAME(_nc_set_curterm)(SCREEN*,TERMINAL*);
extern NCURSES_EXPORT(TERMINAL*) NCURSES_SP_NAME(cur_term)(SCREEN *sp);
extern NCURSES_EXPORT(WINDOW *) NCURSES_SP_NAME(_nc_makenew) (SCREEN*, int, int, int, int, int);
extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(_nc_reset_colors)(SCREEN*);
/****************************************************************************
* Author: Thomas E. Dickey *
+ * and: Juergen Pfeifer *
****************************************************************************/
#include <curses.priv.h>
#include <tic.h>
#include <term_entry.h>
-MODULE_ID("$Id: entries.c,v 1.11 2009/03/14 15:22:37 tom Exp $")
+MODULE_ID("$Id: entries.c,v 1.12 2009/06/06 18:54:42 tom Exp $")
/****************************************************************************
*
_nc_free_tparm();
_nc_tgetent_leaks();
- if (cur_term != 0)
- del_curterm(cur_term);
+ if (HasTerminal(CURRENT_SCREEN))
+ del_curterm(TerminalOf(CURRENT_SCREEN));
_nc_free_entries(_nc_head);
_nc_get_type(0);
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
* and: Thomas E. Dickey 1996-on *
+ * and: Juergen Pfeifer 2008 *
****************************************************************************/
#include <curses.priv.h>
-#include <term.h> /* ena_acs, acs_chars */
#ifndef CUR
-#define CUR SP_TERMTYPE
+#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: lib_acs.c,v 1.39 2009/05/10 00:48:29 tom Exp $")
+MODULE_ID("$Id: lib_acs.c,v 1.40 2009/06/06 18:08:04 tom Exp $")
#if BROKEN_LINKER || USE_REENTRANT
#define MyBuffer _nc_prescreen.real_acs_map
};
#endif
-NCURSES_EXPORT(void)
-_nc_init_acs(void)
+#ifdef USE_TERM_DRIVER
+NCURSES_EXPORT(chtype)
+NCURSES_SP_NAME(_nc_acs_char) (NCURSES_SP_DCLx int c)
{
-#if NCURSES_SP_FUNCS
- SCREEN *sp = CURRENT_SCREEN;
+ chtype *map;
+ if (c < 0 || c >= ACS_LEN)
+ return (chtype) 0;
+ map = (SP_PARM != 0) ? SP_PARM->_acs_map :
+#if BROKEN_LINKER || USE_REENTRANT
+ _nc_prescreen.real_acs_map
+#else
+ acs_map
#endif
+ ;
+ return map[c];
+}
+#endif /* USE_TERM_DRIVER */
+
+NCURSES_EXPORT(void)
+NCURSES_SP_NAME(_nc_init_acs) (NCURSES_SP_DCL0)
+{
chtype *fake_map = acs_map;
- chtype *real_map = SP != 0 ? SP->_acs_map : fake_map;
+ chtype *real_map = SP_PARM != 0 ? SP_PARM->_acs_map : fake_map;
int j;
T(("initializing ACS map"));
for (j = 1; j < ACS_LEN; ++j) {
real_map[j] = 0;
fake_map[j] = A_ALTCHARSET | j;
- if (SP)
- SP->_screen_acs_map[j] = FALSE;
+ if (SP_PARM)
+ SP_PARM->_screen_acs_map[j] = FALSE;
}
} else {
for (j = 1; j < ACS_LEN; ++j) {
real_map['|'] = '!'; /* should be not-equal */
real_map['}'] = 'f'; /* should be pound-sterling symbol */
+#ifdef USE_TERM_DRIVER
+ CallDriver_2(SP_PARM, initacs, real_map, fake_map);
+#else
if (ena_acs != NULL) {
TPUTS_TRACE("ena_acs");
putp(ena_acs);
_nc_unlock_global(tracef);
}
#endif /* TRACE */
+#endif
}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(void)
+_nc_init_acs(void)
+{
+ NCURSES_SP_NAME(_nc_init_acs) (CURRENT_SCREEN);
+}
+#endif
#include <curses.priv.h>
-MODULE_ID("$Id: lib_data.c,v 1.53 2009/05/30 15:59:25 tom Exp $")
+MODULE_ID("$Id: lib_data.c,v 1.54 2009/06/06 18:46:31 tom Exp $")
/*
* OS/2's native linker complains if we don't initialize public data when
NCURSES_EXPORT(WINDOW *)
NCURSES_PUBLIC_VAR(stdscr) (void)
{
- return SP ? SP->_stdscr : 0;
+ return CURRENT_SCREEN ? StdScreen(CURRENT_SCREEN) : 0;
}
NCURSES_EXPORT(WINDOW *)
NCURSES_PUBLIC_VAR(curscr) (void)
{
- return SP ? SP->_curscr : 0;
+ return CURRENT_SCREEN ? CurScreen(CURRENT_SCREEN) : 0;
}
NCURSES_EXPORT(WINDOW *)
NCURSES_PUBLIC_VAR(newscr) (void)
{
- return SP ? SP->_newscr : 0;
+ return CURRENT_SCREEN ? NewScreen(CURRENT_SCREEN) : 0;
}
#else
NCURSES_EXPORT_VAR(WINDOW *) stdscr = 0;
NCURSES_EXPORT(int)
_nc_alloc_screen(void)
{
- return ((my_screen = typeCalloc(SCREEN, 1)) != 0);
+ return ((my_screen = _nc_alloc_screen_sp()) != 0);
}
NCURSES_EXPORT(void)
}
#else
+
NCURSES_EXPORT_VAR(SCREEN *) SP = NULL; /* Some linkers require initialized data... */
#endif
/* *INDENT-OFF* */
0, /* tgetent_index */
0, /* tgetent_sequence */
+#ifndef USE_SP_WINDOWLIST
0, /* _nc_windowlist */
+#endif
#if USE_HOME_TERMINFO
NULL, /* home_terminfo */
{ CHARS_0s, CHARS_0s }, /* traceatr_color_buf */
0, /* traceatr_color_sel */
-1, /* traceatr_color_last */
-
+#if !defined(USE_PTHREADS) && USE_REENTRANT
+ 0, /* nested_tracef */
+#endif
#endif /* TRACE */
#ifdef USE_PTHREADS
PTHREAD_MUTEX_INITIALIZER, /* mutex_curses */
TRUE, /* use_env */
FALSE, /* filter_mode */
A_NORMAL, /* previous_attr */
+#ifndef USE_SP_RIPOFF
RIPOFF_0s, /* ripoff */
NULL, /* rsp */
+#endif
{ /* tparm_state */
#ifdef TRACE
NULL, /* tname */
};
/* *INDENT-ON* */
+/*
+ * wgetch() and other functions with a WINDOW* parameter may use a SCREEN*
+ * internally, and it is useful to allow those to be invoked without switching
+ * SCREEN's, e.g., for multi-threaded applications.
+ */
+NCURSES_EXPORT(SCREEN *)
+_nc_screen_of(WINDOW *win)
+{
+ SCREEN *sp = 0;
+
+ if (win != 0) {
+ WINDOWLIST *wp = (WINDOWLIST *) win;
+ sp = wp->screen;
+ }
+ return (sp);
+}
+
/******************************************************************************/
#ifdef USE_PTHREADS
static void
*/
#include <curses.priv.h>
-#include <term.h> /* cur_term */
-MODULE_ID("$Id: lib_kernel.c,v 1.25 2009/02/15 00:47:52 tom Exp $")
+MODULE_ID("$Id: lib_kernel.c,v 1.27 2009/06/06 21:25:50 tom Exp $")
static int
_nc_vdisable(void)
NCURSES_SP_NAME(erasechar) (NCURSES_SP_DCL0)
{
int result = ERR;
- T((T_CALLED("erasechar()")));
+ TERMINAL *termp = TerminalOf(SP_PARM);
- if (cur_term != 0) {
+ T((T_CALLED("erasechar(%p)"), SP_PARM));
+
+ if (termp != 0) {
#ifdef TERMIOS
- result = cur_term->Ottyb.c_cc[VERASE];
+ result = termp->Ottyb.c_cc[VERASE];
if (result == _nc_vdisable())
result = ERR;
#else
- result = cur_term->Ottyb.sg_erase;
+ result = termp->Ottyb.sg_erase;
#endif
}
returnCode(result);
NCURSES_SP_NAME(killchar) (NCURSES_SP_DCL0)
{
int result = ERR;
- T((T_CALLED("killchar()")));
+ TERMINAL *termp = TerminalOf(SP_PARM);
+
+ T((T_CALLED("killchar(%p)"), SP_PARM));
- if (cur_term != 0) {
+ if (termp != 0) {
#ifdef TERMIOS
- result = cur_term->Ottyb.c_cc[VKILL];
+ result = termp->Ottyb.c_cc[VKILL];
if (result == _nc_vdisable())
result = ERR;
#else
- result = cur_term->Ottyb.sg_kill;
+ result = termp->Ottyb.sg_kill;
#endif
}
returnCode(result);
NCURSES_EXPORT(int)
NCURSES_SP_NAME(flushinp) (NCURSES_SP_DCL0)
{
- T((T_CALLED("flushinp()")));
+ TERMINAL *termp = TerminalOf(SP_PARM);
+
+ T((T_CALLED("flushinp(%p)"), SP_PARM));
- if (cur_term != 0) {
+ if (termp != 0) {
#ifdef TERMIOS
- tcflush(cur_term->Filedes, TCIFLUSH);
+ tcflush(termp->Filedes, TCIFLUSH);
#else
errno = 0;
do {
- ioctl(cur_term->Filedes, TIOCFLUSH, 0);
+ ioctl(termp->Filedes, TIOCFLUSH, 0);
} while
(errno == EINTR);
#endif
#endif
#endif
-MODULE_ID("$Id: lib_napms.c,v 1.18 2009/02/15 00:48:27 tom Exp $")
+MODULE_ID("$Id: lib_napms.c,v 1.19 2009/06/06 18:50:30 tom Exp $")
NCURSES_EXPORT(int)
NCURSES_SP_NAME(napms) (NCURSES_SP_DCLx int ms)
{
T((T_CALLED("napms(%d)"), ms));
+#ifdef USE_TERM_DRIVER
+ CallDriver_1(sp, nap, ms);
+#else /* !USE_TERM_DRIVER */
#if HAVE_NANOSLEEP
{
struct timespec request, remaining;
#else
_nc_timed_wait(0, 0, ms, (int *) 0 EVENTLIST_2nd(0));
#endif
+#endif /* !USE_TERM_DRIVER */
returnCode(OK);
}
/****************************************************************************
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ * and: Thomas E. Dickey 1996-on *
+ * and: Juergen Pfeifer *
****************************************************************************/
#include <curses.priv.h>
-#include <term.h>
-
#ifndef CUR
-#define CUR SP_TERMTYPE
+#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: lib_print.c,v 1.18 2009/05/10 00:48:29 tom Exp $")
+MODULE_ID("$Id: lib_print.c,v 1.19 2009/06/06 20:26:17 tom Exp $")
NCURSES_EXPORT(int)
-mcprint(char *data, int len)
+NCURSES_SP_NAME(mcprint) (NCURSES_SP_DCLx char *data, int len)
/* ship binary character data to the printer via mc4/mc5/mc5p */
{
-#if NCURSES_SP_FUNCS
- SCREEN *sp = CURRENT_SCREEN;
-#endif
char *mybuf, *switchon;
size_t onsize, offsize, res;
errno = 0;
- if (!cur_term || (!prtr_non && (!prtr_on || !prtr_off))) {
+ if (!HasTInfoTerminal(SP_PARM) || (!prtr_non && (!prtr_on || !prtr_off))) {
errno = ENODEV;
return (ERR);
}
* data has actually been shipped to the terminal. If the write(2)
* operation is truly atomic we're protected from this.
*/
- res = write(cur_term->Filedes, mybuf, onsize + len + offsize);
+ res = write(TerminalOf(SP_PARM)->Filedes, mybuf, onsize + len + offsize);
/*
* By giving up our scheduler slot here we increase the odds that the
* kernel will ship the contiguous clist items from the last write
* immediately.
*/
+#ifndef __MINGW32__
(void) sleep(0);
-
+#endif
free(mybuf);
return (res);
}
+
+#if NCURSES_SP_FUNCS && !defined(USE_TERM_DRIVER)
+NCURSES_EXPORT(int)
+mcprint(char *data, int len)
+{
+ return NCURSES_SP_NAME(mcprint) (CURRENT_SCREEN, data, len);
+}
+#endif
#include <term.h> /* lines, columns, cur_term */
-MODULE_ID("$Id: lib_setup.c,v 1.116 2009/05/30 20:39:21 tom Exp $")
+MODULE_ID("$Id: lib_setup.c,v 1.117 2009/06/06 17:56:31 tom Exp $")
/****************************************************************************
*
if (sp != 0
&& sp->_resize != 0) {
if ((new_lines != old_lines) || (new_cols != old_cols))
- sp->_resize(new_lines, new_cols);
+ sp->_resize(NCURSES_SP_ARGx new_lines, new_cols);
sp->_sig_winch = FALSE;
}
}
#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: lib_termcap.c,v 1.66 2009/05/23 23:47:34 tom Exp $")
+MODULE_ID("$Id: lib_termcap.c,v 1.67 2009/05/30 20:05:20 tom Exp $")
NCURSES_EXPORT_VAR(char *) UP = 0;
NCURSES_EXPORT_VAR(char *) BC = 0;
NCURSES_EXPORT(int)
NCURSES_SP_NAME(tgetent) (NCURSES_SP_DCLx char *bufp, const char *name)
{
- int errcode;
+ int errcode = ERR;
int n;
bool found_cache = FALSE;
+#ifdef USE_TERM_DRIVER
+ TERMINAL *termp = 0;
+#endif
START_TRACE();
T((T_CALLED("tgetent()")));
+#ifdef USE_TERM_DRIVER
+ _nc_setupterm_ex(&termp, (NCURSES_CONST char *) name,
+ STDOUT_FILENO, &errcode, TRUE);
+
+ if (termp == 0 ||
+ !((TERMINAL_CONTROL_BLOCK *) termp)->drv->isTerminfo)
+ return (errcode);
+#else
_nc_setupterm((NCURSES_CONST char *) name, STDOUT_FILENO, &errcode, TRUE);
+#endif
/*
* In general we cannot tell if the fixed sgr0 is still used by the
/*
* Also free the terminfo data that we loaded (much bigger leak).
*/
- if (LAST_TRM != 0 && LAST_TRM != cur_term) {
+ if (LAST_TRM != 0 && LAST_TRM != TerminalOf(SP_PARM)) {
TERMINAL *trm = LAST_TRM;
NCURSES_SP_NAME(del_curterm) (NCURSES_SP_ARGx LAST_TRM);
for (CacheInx = 0; CacheInx < TGETENT_MAX; ++CacheInx)
}
CacheInx = best;
}
- LAST_TRM = cur_term;
+ LAST_TRM = TerminalOf(SP_PARM);
LAST_SEQ = ++CacheSeq;
PC = 0;
if (backspace_if_not_bs != NULL)
BC = backspace_if_not_bs;
- if ((FIX_SGR0 = _nc_trim_sgr0(&(cur_term->type))) != 0) {
+ if ((FIX_SGR0 = _nc_trim_sgr0(&(TerminalOf(SP_PARM)->type))) != 0) {
if (!strcmp(FIX_SGR0, exit_attribute_mode)) {
if (FIX_SGR0 != exit_attribute_mode) {
free(FIX_SGR0);
{
unsigned i;
- T((T_CALLED("tgetflag(%s)"), id));
- if (cur_term != 0) {
- TERMTYPE *tp = &(cur_term->type);
+ T((T_CALLED("tgetflag(%p, %s)"), SP_PARM, id));
+ if (HasTInfoTerminal(SP_PARM)) {
+ TERMTYPE *tp = &(TerminalOf(SP_PARM)->type);
for_each_boolean(i, tp) {
const char *capname = ExtBoolname(tp, i, boolcodes);
if (!strncmp(id, capname, 2)) {
{
unsigned i;
- T((T_CALLED("tgetnum(%s)"), id));
- if (cur_term != 0) {
- TERMTYPE *tp = &(cur_term->type);
+ T((T_CALLED("tgetnum(%p, %s)"), SP_PARM, id));
+ if (HasTInfoTerminal(SP_PARM)) {
+ TERMTYPE *tp = &(TerminalOf(SP_PARM)->type);
for_each_number(i, tp) {
const char *capname = ExtNumname(tp, i, numcodes);
if (!strncmp(id, capname, 2)) {
char *result = NULL;
T((T_CALLED("tgetstr(%s,%p)"), id, area));
- if (cur_term != 0) {
- TERMTYPE *tp = &(cur_term->type);
+ if (HasTInfoTerminal(SP_PARM)) {
+ TERMTYPE *tp = &(TerminalOf(SP_PARM)->type);
for_each_string(i, tp) {
const char *capname = ExtStrname(tp, i, strcodes);
if (!strncmp(id, capname, 2)) {
#include <termcap.h> /* ospeed */
#include <tic.h>
-MODULE_ID("$Id: lib_tputs.c,v 1.74 2009/05/23 23:56:23 tom Exp $")
+MODULE_ID("$Id: lib_tputs.c,v 1.75 2009/05/30 19:44:43 tom Exp $")
NCURSES_EXPORT_VAR(char) PC = 0; /* used by termcap library */
NCURSES_EXPORT_VAR(NCURSES_OSPEED) ospeed = 0; /* used by termcap library */
{
T((T_CALLED("delay_output(%p,%d)"), SP_PARM, ms));
+ if (!HasTInfoTerminal(SP_PARM))
+ returnCode(ERR);
+
if (no_pad_char) {
NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_ARG);
napms(ms);
{
COUNT_OUTCHARS(1);
- if (SP_PARM != 0
+ if (HasTInfoTerminal(SP_PARM)
&& SP_PARM->_cleanup) {
char tmp = ch;
/*
}
#endif /* TRACE */
+ if (SP_PARM != 0 && !HasTInfoTerminal(SP_PARM))
+ return ERR;
+
if (!VALID_STRING(string))
return ERR;
- if (cur_term == 0) {
+ if (SP_PARM != 0 && SP_PARM->_term == 0) {
always_delay = FALSE;
normal_delay = TRUE;
} else {
*/
#include <curses.priv.h>
-#include <term.h> /* cur_term */
#ifndef CUR
-#define CUR SP_TERMTYPE
+#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: lib_ttyflags.c,v 1.24 2009/05/10 00:48:29 tom Exp $")
+MODULE_ID("$Id: lib_ttyflags.c,v 1.25 2009/06/06 19:10:05 tom Exp $")
NCURSES_EXPORT(int)
NCURSES_SP_NAME(_nc_get_tty_mode) (NCURSES_SP_DCLx TTY * buf)
{
int result = OK;
- if (buf == 0) {
+ if (buf == 0 || SP_PARM == 0) {
result = ERR;
} else {
- if (cur_term == 0) {
+ TERMINAL *termp = TerminalOf(SP_PARM);
+
+ if (0 == termp) {
result = ERR;
} else {
+#ifdef USE_TERM_DRIVER
+ result = CallDriver_2(SP_PARM, sgmode, FALSE, buf);
+#else
for (;;) {
- if (GET_TTY(cur_term->Filedes, buf) != 0) {
+ if (GET_TTY(termp->Filedes, buf) != 0) {
if (errno == EINTR)
continue;
result = ERR;
}
break;
}
+#endif
}
if (result == ERR)
memset(buf, 0, sizeof(*buf));
TR(TRACE_BITS, ("_nc_get_tty_mode(%d): %s",
- cur_term ? cur_term->Filedes : -1,
+ termp ? termp->Filedes : -1,
_nc_trace_ttymode(buf)));
}
return (result);
{
int result = OK;
- if (buf == 0) {
+ if (buf == 0 || SP_PARM == 0) {
result = ERR;
} else {
- if (cur_term == 0) {
+ TERMINAL *termp = TerminalOf(SP_PARM);
+
+ if (0 == termp) {
result = ERR;
} else {
+#ifdef USE_TERM_DRIVER
+ result = CallDriver_2(SP_PARM, sgmode, TRUE, buf);
+#else
for (;;) {
- if (SET_TTY(cur_term->Filedes, buf) != 0) {
+ if (SET_TTY(termp->Filedes, buf) != 0) {
if (errno == EINTR)
continue;
if ((errno == ENOTTY) && (SP_PARM != 0))
}
break;
}
+#endif
}
TR(TRACE_BITS, ("_nc_set_tty_mode(%d): %s",
- cur_term ? cur_term->Filedes : -1,
+ termp ? termp->Filedes : -1,
_nc_trace_ttymode(buf)));
}
return (result);
NCURSES_SP_NAME(def_shell_mode) (NCURSES_SP_DCL0)
{
int rc = ERR;
+ TERMINAL *termp = TerminalOf(SP_PARM);
- T((T_CALLED("def_shell_mode()")));
+ T((T_CALLED("def_shell_mode(%p)"), SP_PARM));
- if (cur_term != 0) {
+ if (termp != 0) {
+#ifdef USE_TERM_DRIVER
+ rc = CallDriver_2(SP_PARM, mode, FALSE, TRUE);
+#else
/*
* If XTABS was on, remove the tab and backtab capabilities.
*/
- if (_nc_get_tty_mode(&cur_term->Ottyb) == OK) {
+ if (_nc_get_tty_mode(&termp->Ottyb) == OK) {
#ifdef TERMIOS
- if (cur_term->Ottyb.c_oflag & OFLAGS_TABS)
+ if (termp->Ottyb.c_oflag & OFLAGS_TABS)
tab = back_tab = NULL;
#else
- if (cur_term->Ottyb.sg_flags & XTABS)
+ if (termp->Ottyb.sg_flags & XTABS)
tab = back_tab = NULL;
#endif
rc = OK;
}
+#endif
}
returnCode(rc);
}
NCURSES_SP_NAME(def_prog_mode) (NCURSES_SP_DCL0)
{
int rc = ERR;
+ TERMINAL *termp = TerminalOf(SP_PARM);
- T((T_CALLED("def_prog_mode()")));
+ T((T_CALLED("def_prog_mode(%p)"), SP_PARM));
- if (cur_term != 0) {
+ if (termp != 0) {
+#ifdef USE_TERM_DRIVER
+ rc = CallDriver_2(SP_PARM, mode, TRUE, TRUE);
+#else
/*
* Turn off the XTABS bit in the tty structure if it was on.
*/
- if (_nc_get_tty_mode(&cur_term->Nttyb) == OK) {
+ if (_nc_get_tty_mode(&termp->Nttyb) == OK) {
#ifdef TERMIOS
- cur_term->Nttyb.c_oflag &= ~OFLAGS_TABS;
+ termp->Nttyb.c_oflag &= ~OFLAGS_TABS;
#else
- cur_term->Nttyb.sg_flags &= ~XTABS;
+ termp->Nttyb.sg_flags &= ~XTABS;
#endif
rc = OK;
}
+#endif
}
returnCode(rc);
}
NCURSES_EXPORT(int)
NCURSES_SP_NAME(reset_prog_mode) (NCURSES_SP_DCL0)
{
- T((T_CALLED("reset_prog_mode()")));
+ int rc = ERR;
+ TERMINAL *termp = TerminalOf(SP_PARM);
- if (cur_term != 0) {
- if (_nc_set_tty_mode(&cur_term->Nttyb) == OK) {
+ T((T_CALLED("reset_prog_mode(%p)"), SP_PARM));
+
+ if (termp != 0) {
+#ifdef USE_TERM_DRIVER
+ rc = CallDriver_2(SP_PARM, mode, TRUE, FALSE);
+#else
+ if (_nc_set_tty_mode(&termp->Nttyb) == OK) {
if (SP_PARM) {
if (SP_PARM->_keypad_on)
_nc_keypad(SP_PARM, TRUE);
NC_BUFFERED(SP_PARM, TRUE);
}
- returnCode(OK);
+ rc = OK;
}
+#endif
}
- returnCode(ERR);
+ returnCode(rc);
}
#if NCURSES_SP_FUNCS
NCURSES_EXPORT(int)
NCURSES_SP_NAME(reset_shell_mode) (NCURSES_SP_DCL0)
{
- T((T_CALLED("reset_shell_mode()")));
+ int rc = ERR;
+ TERMINAL *termp = TerminalOf(SP_PARM);
- if (cur_term != 0) {
+ T((T_CALLED("reset_shell_mode(%p)"), SP_PARM));
+
+ if (termp != 0) {
+#ifdef USE_TERM_DRIVER
+ rc = CallDriver_2(SP_PARM, mode, FALSE, FALSE);
+#else
if (SP_PARM) {
_nc_keypad(SP_PARM, FALSE);
_nc_flush();
NC_BUFFERED(SP_PARM, FALSE);
}
- returnCode(_nc_set_tty_mode(&cur_term->Ottyb));
+ rc = _nc_set_tty_mode(&termp->Ottyb);
+#endif
}
- returnCode(ERR);
+ returnCode(rc);
}
#if NCURSES_SP_FUNCS
#endif
static TTY *
-saved_tty(void)
+saved_tty(NCURSES_SP_DCL0)
{
TTY *result = 0;
- if (SP != 0) {
- result = &(SP->_saved_tty);
+ if (SP_PARM != 0) {
+ result = (TTY *) & (SP_PARM->_saved_tty);
} else {
if (_nc_prescreen.saved_tty == 0) {
_nc_prescreen.saved_tty = typeCalloc(TTY, 1);
**
*/
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(savetty) (NCURSES_SP_DCL0)
+{
+ T((T_CALLED("savetty(%p)"), SP_PARM));
+ returnCode(NCURSES_SP_NAME(_nc_get_tty_mode) (NCURSES_SP_ARGx saved_tty(NCURSES_SP_ARG)));
+}
+
+#if NCURSES_SP_FUNCS
NCURSES_EXPORT(int)
savetty(void)
{
- T((T_CALLED("savetty()")));
+ return NCURSES_SP_NAME(savetty) (CURRENT_SCREEN);
+}
+#endif
- returnCode(_nc_get_tty_mode(saved_tty()));
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(resetty) (NCURSES_SP_DCL0)
+{
+ T((T_CALLED("resetty(%p)"), SP_PARM));
+ returnCode(NCURSES_SP_NAME(_nc_set_tty_mode) (NCURSES_SP_ARGx saved_tty(NCURSES_SP_ARG)));
}
+#if NCURSES_SP_FUNCS
NCURSES_EXPORT(int)
resetty(void)
{
- T((T_CALLED("resetty()")));
-
- returnCode(_nc_set_tty_mode(saved_tty()));
+ return NCURSES_SP_NAME(resetty) (CURRENT_SCREEN);
}
+#endif
#include <ctype.h>
-MODULE_ID("$Id: tty_update.c,v 1.256 2009/05/17 00:13:49 tom Exp $")
+MODULE_ID("$Id: tty_update.c,v 1.257 2009/06/06 20:26:16 tom Exp $")
/*
* This define controls the line-breakout optimization. Every once in a
static NCURSES_INLINE void
GoTo(NCURSES_SP_DCLx int const row, int const col)
{
- TR(TRACE_MOVE, ("GoTo(%d, %d) from (%d, %d)",
- row, col, SP_PARM->_cursrow, SP_PARM->_curscol));
+ TR(TRACE_MOVE, ("GoTo(%p, %d, %d) from (%d, %d)",
+ SP_PARM, row, col, SP_PARM->_cursrow, SP_PARM->_curscol));
position_check(SP_PARM, SP_PARM->_cursrow, SP_PARM->_curscol, "GoTo");
- mvcur(SP_PARM->_cursrow, SP_PARM->_curscol, row, col);
+ NCURSES_SP_NAME(mvcur) (NCURSES_SP_ARGx SP_PARM->_cursrow,
+ SP_PARM->_curscol, row, col);
position_check(SP_PARM, SP_PARM->_cursrow, SP_PARM->_curscol, "GoTo2");
}
&& runcount > SP_PARM->_ech_cost + SP_PARM->_cup_ch_cost
&& can_clear_with(NCURSES_SP_ARGx CHREF(ntext0))) {
UpdateAttrs(SP_PARM, ntext0);
- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx TPARM_1(erase_chars, runcount));
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx
+ TPARM_1(erase_chars, runcount));
/*
* If this is the last part of the given interval,
struct tms before, after;
#endif /* USE_TRACE_TIMES */
- T((T_CALLED("doupdate()")));
+ T((T_CALLED("_nc_tinfo:doupdate(%p)"), SP_PARM));
#if !USE_REENTRANT
/*
/* find end of span, if it's onscreen */
for (m = i; m < screen_lines(SP_PARM); m++) {
for (; n < screen_columns(SP_PARM); n++) {
- attr_t testattr
- = AttrOf(NewScreen(SP_PARM)->_line[m].text[n]);
-
+ attr_t testattr =
+ AttrOf(NewScreen(SP_PARM)->_line[m].text[n]);
if ((testattr & SP_PARM->_xmc_triggers) == rattr) {
end_onscreen = TRUE;
TR(TRACE_ATTRS,
/* turn off new attributes over span */
for (p = i; p < screen_lines(SP_PARM); p++) {
for (; q < screen_columns(SP_PARM); q++) {
- attr_t testattr =
- AttrOf(NewScreen(SP_PARM)->_line[p].text[q]);
+ attr_t testattr = AttrOf(newscr->_line[p].text[q]);
if ((testattr & SP_PARM->_xmc_triggers) == rattr)
goto foundend;
RemAttr(NewScreen(SP_PARM)->_line[p].text[q], turnon);
nonempty = min(screen_lines(SP_PARM), NewScreen(SP_PARM)->_maxy + 1);
if (SP_PARM->_scrolling) {
- _nc_scroll_optimize();
+ NCURSES_SP_NAME(_nc_scroll_optimize) (NCURSES_SP_ARG);
}
nonempty = ClrBottom(NCURSES_SP_ARGx nonempty);
}
/*
- * newscr.line[i].firstchar is normally set
- * by wnoutrefresh. curscr.line[i].firstchar
+ * newscr->line[i].firstchar is normally set
+ * by wnoutrefresh. curscr->line[i].firstchar
* is normally set by _nc_scroll_window in the
* vertical-movement optimization code,
*/
* in the wbkgd() call. Assume 'stdscr' for this case.
*/
#define BCE_ATTRS (A_NORMAL|A_COLOR)
-#define BCE_BKGD(win) (((win) == CurScreen(SP_PARM) ? StdScreen(SP_PARM) : (win))->_nc_bkgd)
+#define BCE_BKGD(sp,win) (((win) == CurScreen(sp) ? StdScreen(sp) : (win))->_nc_bkgd)
static NCURSES_INLINE NCURSES_CH_T
ClrBlank(NCURSES_SP_DCLx WINDOW *win)
{
NCURSES_CH_T blank = blankchar;
if (back_color_erase)
- AddAttr(blank, (AttrOf(BCE_BKGD(win)) & BCE_ATTRS));
+ AddAttr(blank, (AttrOf(BCE_BKGD(SP_PARM, win)) & BCE_ATTRS));
return blank;
}
{
int j;
- if (CurScreen(SP_PARM) != 0
+ if (SP_PARM != 0 && CurScreen(SP_PARM) != 0
&& SP_PARM->_cursrow >= 0) {
for (j = SP_PARM->_curscol; j < screen_columns(SP_PARM); j++) {
if (j >= 0) {
#define xmc_turn_on(sp,a,b) ((((a)^(b)) & ~(a) & (sp)->_xmc_triggers) != 0)
#endif
-#define xmc_new(sp,r,c) NewScreen(SP_PARM)->_line[r].text[c]
+#define xmc_new(sp,r,c) NewScreen(sp)->_line[r].text[c]
#define xmc_turn_off(sp,a,b) xmc_turn_on(sp,b,a)
#endif /* USE_XMC_SUPPORT */
if (attrchanged) { /* we may have to disregard the whole line */
GoTo(NCURSES_SP_ARGx lineno, firstChar);
ClrToEOL(NCURSES_SP_ARGx
- ClrBlank(NCURSES_SP_ARGx CurScreen(SP_PARM)),
- FALSE);
+ ClrBlank(NCURSES_SP_ARGx
+ CurScreen(SP_PARM)), FALSE);
PutRange(NCURSES_SP_ARGx
oldLine, newLine, lineno, 0,
screen_columns(SP_PARM) - 1);
ClrToEOL(NCURSES_SP_ARGx blank, FALSE);
} else if ((nLastChar != oLastChar)
&& (!CharEq(newLine[nLastChar], oldLine[oLastChar])
- || !(_nc_idcok && has_ic()))) {
+ || !(SP_PARM->_nc_sp_idcok
+ && NCURSES_SP_NAME(has_ic) (NCURSES_SP_ARG)))) {
GoTo(NCURSES_SP_ARGx lineno, firstChar);
if ((oLastChar - nLastChar) > SP_PARM->_el_cost) {
if (PutRange(NCURSES_SP_ARGx
} else if (clr_eos) {
SP_PARM->_cursrow = SP_PARM->_curscol = -1;
GoTo(NCURSES_SP_ARGx 0, 0);
-
UpdateAttrs(SP_PARM, blank);
TPUTS_TRACE("clr_eos");
NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
NCURSES_SP_NAME(_nc_outch));
} else if (clr_eol) {
SP_PARM->_cursrow = SP_PARM->_curscol = -1;
-
UpdateAttrs(SP_PARM, blank);
for (i = 0; i < screen_lines(SP_PARM); i++) {
GoTo(NCURSES_SP_ARGx i, 0);
int maxy)
/* scroll region from top to bot by n lines */
{
- NCURSES_CH_T blank = ClrBlank(NCURSES_SP_ARGx StdScreen(SP_PARM));
+ NCURSES_CH_T blank;
int i;
bool cursor_saved = FALSE;
int res;
- TR(TRACE_MOVE, ("mvcur_scrolln(%d, %d, %d, %d)", n, top, bot, maxy));
+ TR(TRACE_MOVE, ("_nc_scrolln(%p, %d, %d, %d, %d)", SP_PARM, n, top, bot, maxy));
+
+ if (!IsValidScreen(SP_PARM))
+ return (ERR);
+
+ blank = ClrBlank(NCURSES_SP_ARGx StdScreen(SP_PARM));
#if USE_XMC_SUPPORT
/*
SP_PARM->_cursrow = SP_PARM->_curscol = -1;
}
- if (res == ERR && _nc_idlok)
+ if (res == ERR && SP_PARM->_nc_sp_idlok)
res = scroll_idl(NCURSES_SP_ARGx n, top, bot - n + 1, blank);
/*
SP_PARM->_cursrow = SP_PARM->_curscol = -1;
}
- if (res == ERR && _nc_idlok)
+ if (res == ERR && SP_PARM->_nc_sp_idlok)
res = scroll_idl(NCURSES_SP_ARGx -n, bot + n + 1, top, blank);
/*
/* reset color pairs and definitions */
if (SP_PARM->_coloron || SP_PARM->_color_defs)
- _nc_reset_colors();
+ NCURSES_SP_NAME(_nc_reset_colors) (NCURSES_SP_ARG);
/* restore user-defined colors, if any */
if (SP_PARM->_color_defs < 0) {
static const NCURSES_CH_T blank = NewChar(BLANK_TEXT);
SP_PARM->_default_color = TRUE;
NCURSES_SP_NAME(_nc_do_color) (NCURSES_SP_ARGx
- -1, 0,
+ -1,
+ 0,
FALSE,
NCURSES_SP_NAME(_nc_outch));
SP_PARM->_default_color = FALSE;
- mvcur(SP_PARM->_cursrow,
- SP_PARM->_curscol,
- screen_lines(SP_PARM) - 1, 0);
+ NCURSES_SP_NAME(mvcur) (NCURSES_SP_ARGx
+ SP_PARM->_cursrow,
+ SP_PARM->_curscol,
+ screen_lines(SP_PARM) - 1,
+ 0);
ClrToEOL(NCURSES_SP_ARGx blank, TRUE);
}
#endif
if (SP_PARM->_color_defs) {
- _nc_reset_colors();
+ NCURSES_SP_NAME(_nc_reset_colors) (NCURSES_SP_ARG);
}
}