+ continue integrating "sp-funcs" by Juergen Pfeifer (incomplete).
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
-------------------------------------------------------------------------------
--- $Id: NEWS,v 1.1384 2009/05/02 22:27:02 tom Exp $
+-- $Id: NEWS,v 1.1386 2009/05/10 21:27:04 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.
+20090510
+ + continue integrating "sp-funcs" by Juergen Pfeifer (incomplete).
+
20090502
+ continue integrating "sp-funcs" by Juergen Pfeifer (incomplete).
+ add vwmterm terminfo entry (patch by Bryan Christ).
# use or other dealings in this Software without prior written #
# authorization. #
##############################################################################
-# $Id: dist.mk,v 1.697 2009/05/02 17:26:04 tom Exp $
+# $Id: dist.mk,v 1.699 2009/05/10 21:27:04 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 = 20090502
+NCURSES_PATCH = 20090510
# We don't append the patch to the version, since this only applies to releases
VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
print "/* and: Thomas E. Dickey 1995-on */"
print "/****************************************************************************/"
print ""
- print "/* $Id: MKterm.h.awk.in,v 1.56 2009/05/02 19:25:57 tom Exp $ */"
+ print "/* $Id: MKterm.h.awk.in,v 1.57 2009/05/09 15:54:50 tom Exp $ */"
print ""
print "/*"
print "** term.h -- Definition of struct term"
print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tgetent) (SCREEN*, char *, const char *);"
print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tgetflag) (SCREEN*, NCURSES_CONST char *);"
print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tgetnum) (SCREEN*, NCURSES_CONST char *);"
- print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tputs) (SCREEN*, const char *, int, int (*)(int));"
+ print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tputs) (SCREEN*, const char *, int, NCURSES_SP_OUTC);"
print ""
print "extern NCURSES_EXPORT(TERMINAL *) NCURSES_SP_NAME(set_curterm) (SCREEN*, TERMINAL *);"
print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(del_curterm) (SCREEN*, TERMINAL *);"
* and: Thomas E. Dickey 1996-on *
****************************************************************************/
-/* $Id: curses.h.in,v 1.198 2009/05/02 21:59:55 tom Exp $ */
+/* $Id: curses.h.in,v 1.199 2009/05/09 15:48:04 tom Exp $ */
#ifndef __NCURSES_H
#define __NCURSES_H
#define GCC_UNUSED /* nothing */
#endif
+/*
+ * Curses uses a helper function. Define our type for this to simplify
+ * extending it for the sp-funcs feature.
+ */
+typedef int (*NCURSES_OUTC)(int);
+
/*
* Function prototypes. This is the complete X/Open Curses list of required
* functions. Those marked `generated' will have sources generated from the
extern NCURSES_EXPORT(int) untouchwin (WINDOW *); /* generated */
extern NCURSES_EXPORT(void) use_env (bool); /* implemented */
extern NCURSES_EXPORT(int) vidattr (chtype); /* implemented */
-extern NCURSES_EXPORT(int) vidputs (chtype, int (*)(int)); /* implemented */
+extern NCURSES_EXPORT(int) vidputs (chtype, NCURSES_OUTC); /* implemented */
extern NCURSES_EXPORT(int) vline (chtype, int); /* generated */
extern NCURSES_EXPORT(int) vwprintw (WINDOW *, const char *,va_list); /* implemented */
extern NCURSES_EXPORT(int) vw_printw (WINDOW *, const char *,va_list); /* generated */
#define NCURSES_SP_FUNCS @NCURSES_PATCH@
#define NCURSES_SP_NAME(name) name##_sp
+/* Define the sp-funcs helper function */
+#define NCURSES_SP_OUTC NCURSES_SP_NAME(NCURSES_OUTC)
+typedef int (*NCURSES_SP_OUTC)(SCREEN*, int);
+
extern NCURSES_EXPORT(SCREEN*) new_prescr(void); /* implemented */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(baudrate) (SCREEN*); /* implemented */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(ungetch) (SCREEN*, int); /* implemented */
extern NCURSES_EXPORT(void) NCURSES_SP_NAME(use_env) (SCREEN*, bool); /* implemented */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vidattr) (SCREEN*, chtype); /* implemented */
-extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vidputs) (SCREEN*, chtype, int (*)(int)); /* implemented */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vidputs) (SCREEN*, chtype, NCURSES_SP_OUTC); /* implemented */
#if @NCURSES_EXT_FUNCS@
extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(keybound) (SCREEN*, int, int);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(assume_default_colors) (SCREEN*, int, int);
#undef NCURSES_SP_FUNCS
#define NCURSES_SP_FUNCS 0
#define NCURSES_SP_NAME(name) name
+#define NCURSES_SP_OUTC NCURSES_OUTC
#endif
/* attributes */
-/* $Id: curses.wide,v 1.38 2009/05/02 23:12:00 tom Exp $ */
+/* $Id: curses.wide,v 1.39 2009/05/09 15:43:00 tom Exp $ */
/*
* vile:cmode:
* This file is part of ncurses, designed to be appended after curses.h.in
extern NCURSES_EXPORT(attr_t) term_attrs (void); /* implemented */
extern NCURSES_EXPORT(int) unget_wch (const wchar_t); /* implemented */
extern NCURSES_EXPORT(int) vid_attr (attr_t, short, void *); /* implemented */
-extern NCURSES_EXPORT(int) vid_puts (attr_t, short, void *, int (*)(int)); /* implemented */
+extern NCURSES_EXPORT(int) vid_puts (attr_t, short, void *, NCURSES_OUTC); /* implemented */
extern NCURSES_EXPORT(int) vline_set (const cchar_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) wadd_wch (WINDOW *,const cchar_t *); /* implemented */
extern NCURSES_EXPORT(int) wadd_wchnstr (WINDOW *,const cchar_t *,int); /* implemented */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(unget_wch) (SCREEN*, const wchar_t); /* implemented */
extern NCURSES_EXPORT(wchar_t*) NCURSES_SP_NAME(wunctrl) (SCREEN*, cchar_t *); /* implemented */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vid_attr) (SCREEN*, attr_t, short, void *);
-extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vid_puts) (SCREEN*, attr_t, short, void *, int (*)(int));
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vid_puts) (SCREEN*, attr_t, short, void *, NCURSES_SP_OUTC);
#endif
#ifndef NCURSES_NOMACROS
-# $Id: MKkeyname.awk,v 1.41 2009/02/15 00:24:58 tom Exp $
+# $Id: MKkeyname.awk,v 1.43 2009/05/09 19:01:49 tom Exp $
##############################################################################
# Copyright (c) 1999-2008,2009 Free Software Foundation, Inc. #
# #
print "#define SIZEOF_TABLE 256"
print "#define MyTable _nc_globals.keyname_table"
print ""
- print "NCURSES_EXPORT(NCURSES_CONST char *) _nc_keyname (SCREEN *sp, int c)"
+ print "NCURSES_EXPORT(NCURSES_CONST char *)"
+ print "safe_keyname (SCREEN *sp, int c)"
print "{"
print " int i;"
print " char name[20];"
print " result = MyTable[c];"
print " }"
print "#if NCURSES_EXT_FUNCS && NCURSES_XNAMES"
- print " } else if (result == 0 && cur_term != 0) {"
+ print " } else if (result == 0 && HasTerminal(sp)) {"
print " int j, k;"
print " char * bound;"
- print " TERMTYPE *tp = &(cur_term->type);"
+ print " TERMTYPE *tp = &(TerminalOf(sp)->type);"
print " int save_trace = _nc_tracing;"
print ""
print " _nc_tracing = 0; /* prevent recursion via keybound() */"
- print " for (j = 0; (bound = keybound(c, j)) != 0; ++j) {"
+ print " for (j = 0; (bound = NCURSES_SP_NAME(keybound)(NCURSES_SP_ARGx c, j)) != 0; ++j) {"
print " for(k = STRCOUNT; k < (int) NUM_STRINGS(tp); k++) {"
print " if (tp->Strings[k] != 0 && !strcmp(bound, tp->Strings[k])) {"
print " result = ExtStrname(tp, k, strnames);"
print "}"
print ""
print "NCURSES_EXPORT(NCURSES_CONST char *)"
- print "NCURSES_SP_NAME(keyname) (NCURSES_SP_DCLx int c)"
- print "{"
- print "\treturn _nc_keyname(SP_PARM, c);"
- print "}"
- print ""
- print "#if NCURSES_SP_FUNCS"
- print "NCURSES_EXPORT(NCURSES_CONST char *)"
print "keyname (int c)"
print "{"
- print " return NCURSES_SP_NAME(keyname) (CURRENT_SCREEN, c);"
+ print " return safe_keyname (CURRENT_SCREEN, c);"
print "}"
- print "#endif"
print ""
print "#if NO_LEAKS"
print "void _nc_keyname_leaks(void)"
#include <curses.priv.h>
-MODULE_ID("$Id: define_key.c,v 1.15 2009/02/15 00:30:40 tom Exp $")
+MODULE_ID("$Id: define_key.c,v 1.17 2009/05/09 18:30:16 tom Exp $")
NCURSES_EXPORT(int)
NCURSES_SP_NAME(define_key) (NCURSES_SP_DCLx const char *str, int keycode)
{
int code = ERR;
- T((T_CALLED("define_key(%s,%d)"), _nc_visbuf(str), keycode));
- if (SP_PARM == 0) {
+ T((T_CALLED("define_key(%p, %s,%d)"), SP_PARM, _nc_visbuf(str), keycode));
+ if (SP_PARM == 0 || !HasTInfoTerminal(SP_PARM)) {
code = ERR;
} else if (keycode > 0) {
unsigned ukey = (unsigned) keycode;
if (str != 0) {
- define_key(str, 0);
- } else if (has_key(keycode)) {
+ NCURSES_SP_NAME(define_key) (NCURSES_SP_ARGx str, 0);
+ } else if (NCURSES_SP_NAME(has_key) (NCURSES_SP_ARGx keycode)) {
while (_nc_remove_key(&(SP_PARM->_keytry), ukey))
code = OK;
}
if (str != 0) {
- if (key_defined(str) == 0) {
+ if (NCURSES_SP_NAME(key_defined) (NCURSES_SP_ARGx str) == 0) {
if (_nc_add_to_try(&(SP_PARM->_keytry), str, ukey) == OK) {
code = OK;
} else {
#include <curses.priv.h>
#include <term.h> /* beep, flash */
-MODULE_ID("$Id: lib_beep.c,v 1.11 2009/02/15 00:32:06 tom Exp $")
+#ifndef CUR
+#define CUR SP_TERMTYPE
+#endif
+
+MODULE_ID("$Id: lib_beep.c,v 1.13 2009/05/10 00:48:29 tom Exp $")
/*
* beep()
#include <term.h>
#include <tic.h>
-MODULE_ID("$Id: lib_color.c,v 1.88 2009/02/15 00:33:02 tom Exp $")
+#ifndef CUR
+#define CUR SP_TERMTYPE
+#endif
+
+MODULE_ID("$Id: lib_color.c,v 1.91 2009/05/10 00:48:29 tom Exp $")
/*
* These should be screen structure members. They need to be globals for
}
static void
-set_background_color(int bg, int (*outc) (int))
+set_background_color(NCURSES_SP_DCLx int bg, NCURSES_SP_OUTC outc)
{
if (set_a_background) {
TPUTS_TRACE("set_a_background");
- tputs(TPARM_1(set_a_background, bg), 1, outc);
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
+ TPARM_1(set_a_background, bg),
+ 1, outc);
} else {
TPUTS_TRACE("set_background");
- tputs(TPARM_1(set_background, toggled_colors(bg)), 1, outc);
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
+ TPARM_1(set_background, toggled_colors(bg)),
+ 1, outc);
}
}
static void
-set_foreground_color(int fg, int (*outc) (int))
+set_foreground_color(NCURSES_SP_DCLx int fg, NCURSES_SP_OUTC outc)
{
if (set_a_foreground) {
TPUTS_TRACE("set_a_foreground");
- tputs(TPARM_1(set_a_foreground, fg), 1, outc);
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
+ TPARM_1(set_a_foreground, fg),
+ 1, outc);
} else {
TPUTS_TRACE("set_foreground");
- tputs(TPARM_1(set_foreground, toggled_colors(fg)), 1, outc);
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
+ TPARM_1(set_foreground, toggled_colors(fg)),
+ 1, outc);
}
}
static void
-init_color_table(void)
+init_color_table(NCURSES_SP_DCL0)
{
const color_t *tp;
int n;
* Reset the color pair, e.g., to whatever color pair 0 is.
*/
static bool
-reset_color_pair(void)
+reset_color_pair(NCURSES_SP_DCL0)
{
bool result = FALSE;
bool
_nc_reset_colors(void)
{
+#if NCURSES_SP_FUNCS
+ SCREEN *sp = CURRENT_SCREEN;
+#endif
int result = FALSE;
T((T_CALLED("_nc_reset_colors()")));
if (SP->_color_defs > 0)
SP->_color_defs = -(SP->_color_defs);
- if (reset_color_pair())
+ if (reset_color_pair(NCURSES_SP_ARG))
result = TRUE;
if (orig_colors != 0) {
TPUTS_TRACE("orig_colors");
result = OK;
} else {
- if (reset_color_pair() != TRUE) {
- set_foreground_color(default_fg(), _nc_outch);
- set_background_color(default_bg(), _nc_outch);
+ if (reset_color_pair(NCURSES_SP_ARG) != TRUE) {
+ set_foreground_color(NCURSES_SP_ARGx
+ default_fg(),
+ NCURSES_SP_NAME(_nc_outch));
+ set_background_color(NCURSES_SP_ARGx
+ default_bg(),
+ NCURSES_SP_NAME(_nc_outch));
}
if (max_pairs > 0 && max_colors > 0) {
if (SP_PARM->_color_table != 0) {
SP_PARM->_color_pairs[0] = PAIR_OF(default_fg(),
default_bg());
- init_color_table();
+ init_color_table(NCURSES_SP_ARG);
T(("started color: COLORS = %d, COLOR_PAIRS = %d",
COLORS, COLOR_PAIRS));
#endif
NCURSES_EXPORT(void)
-_nc_do_color(short old_pair, short pair, bool reverse, int (*outc) (int))
+NCURSES_SP_NAME(_nc_do_color) (NCURSES_SP_DCLx
+ short old_pair,
+ short pair,
+ bool reverse,
+ NCURSES_SP_OUTC outc)
{
NCURSES_COLOR_T fg = COLOR_DEFAULT;
NCURSES_COLOR_T bg = COLOR_DEFAULT;
} else if (pair != 0) {
if (set_color_pair) {
TPUTS_TRACE("set_color_pair");
- tputs(TPARM_1(set_color_pair, pair), 1, outc);
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
+ TPARM_1(set_color_pair, pair),
+ 1, outc);
return;
} else if (SP != 0) {
pair_content((short) pair, &fg, &bg);
if (SP->_has_sgr_39_49
&& isDefaultColor(old_bg)
&& !isDefaultColor(old_fg)) {
- tputs("\033[39m", 1, outc);
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx "\033[39m", 1, outc);
} else if (SP->_has_sgr_39_49
&& isDefaultColor(old_fg)
&& !isDefaultColor(old_bg)) {
- tputs("\033[49m", 1, outc);
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx "\033[49m", 1, outc);
} else
#endif
- reset_color_pair();
+ reset_color_pair(NCURSES_SP_ARG);
}
} else {
- reset_color_pair();
+ reset_color_pair(NCURSES_SP_ARG);
if (old_pair < 0)
return;
}
fg, bg));
if (!isDefaultColor(fg)) {
- set_foreground_color(fg, outc);
+ set_foreground_color(NCURSES_SP_ARGx fg, outc);
}
if (!isDefaultColor(bg)) {
- set_background_color(bg, outc);
+ set_background_color(NCURSES_SP_ARGx bg, outc);
}
}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(void)
+_nc_do_color(short old_pair, short pair, bool reverse, NCURSES_OUTC outc)
+{
+ SetSafeOutcWrapper(outc);
+ NCURSES_SP_NAME(_nc_do_color) (CURRENT_SCREEN,
+ old_pair,
+ pair,
+ reverse,
+ _nc_outc_wrapper);
+}
+#endif
#include <curses.priv.h>
-MODULE_ID("$Id: lib_delwin.c,v 1.17 2008/06/07 14:10:56 tom Exp $")
+MODULE_ID("$Id: lib_delwin.c,v 1.18 2009/05/09 18:30:57 tom Exp $")
static bool
cannot_delete(WINDOW *win)
WINDOWLIST *p;
bool result = TRUE;
- for (each_window(p)) {
+ for (each_window(SP, p)) {
if (&(p->win) == win) {
result = FALSE;
} else if ((p->win._flags & _SUBWIN) != 0
#include <curses.priv.h>
#include <term.h>
-MODULE_ID("$Id: lib_dft_fgbg.c,v 1.19 2009/02/14 21:53:21 tom Exp $")
+#ifndef CUR
+#define CUR SP_TERMTYPE
+#endif
+
+MODULE_ID("$Id: lib_dft_fgbg.c,v 1.21 2009/05/10 00:48:29 tom Exp $")
/*
* Modify the behavior of color-pair 0 so that the library doesn't assume that
NCURSES_SP_NAME(use_default_colors) (NCURSES_SP_DCL0)
{
T((T_CALLED("use_default_colors()")));
- returnCode(NCURSES_SP_NAME(assume_default_colors) (NCURSES_SP_ARGx - 1, -1));
+ returnCode(NCURSES_SP_NAME(assume_default_colors) (NCURSES_SP_ARGx -1, -1));
}
#if NCURSES_SP_FUNCS
#include <curses.priv.h>
#include <term.h> /* beep, flash */
-MODULE_ID("$Id: lib_flash.c,v 1.7 2009/02/15 00:35:15 tom Exp $")
+#ifndef CUR
+#define CUR SP_TERMTYPE
+#endif
+
+MODULE_ID("$Id: lib_flash.c,v 1.9 2009/05/10 00:48:29 tom Exp $")
/*
* flash()
extern int malloc_errfd; /* FIXME */
#endif
-MODULE_ID("$Id: lib_freeall.c,v 1.57 2009/04/19 14:31:26 tom Exp $")
+MODULE_ID("$Id: lib_freeall.c,v 1.58 2009/05/09 18:34:30 tom Exp $")
/*
* Free all ncurses data. This is used for testing only (there's no practical
if (SP_PARM != 0) {
_nc_lock_global(curses);
- while (_nc_windows != 0) {
+ while (WindowList(SP_PARM) != 0) {
bool deleted = FALSE;
/* Delete only windows that're not a parent */
- for (each_window(p)) {
+ for (each_window(SP_PARM, p)) {
bool found = FALSE;
- for (each_window(q)) {
+ for (each_window(SP_PARM, q)) {
if ((p != q)
&& (q->win._flags & _SUBWIN)
&& (&(p->win) == q->win._parent)) {
/****************************************************************************
- * 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 *
*/
#include <curses.priv.h>
-#include <term.h>
-MODULE_ID("$Id: lib_getstr.c,v 1.27 2008/08/16 19:20:04 tom Exp $")
+MODULE_ID("$Id: lib_getstr.c,v 1.28 2009/05/09 17:02:41 tom Exp $")
/*
* This wipes out the last character, no matter whether it was a tab, control
if (!win)
returnCode(ERR);
- _nc_get_tty_mode(&buf);
+ NCURSES_SP_NAME(_nc_get_tty_mode) (NCURSES_SP_ARGx &buf);
oldnl = sp->_nl;
oldecho = sp->_echo;
oldraw = sp->_raw;
oldcbreak = sp->_cbreak;
- nl();
- noecho();
- noraw();
- cbreak();
+ NCURSES_SP_NAME(nl) (NCURSES_SP_ARG);
+ NCURSES_SP_NAME(noecho) (NCURSES_SP_ARG);
+ NCURSES_SP_NAME(noraw) (NCURSES_SP_ARG);
+ NCURSES_SP_NAME(cbreak) (NCURSES_SP_ARG);
- erasec = erasechar();
- killc = killchar();
+ erasec = NCURSES_SP_NAME(erasechar) (NCURSES_SP_ARG);
+ killc = NCURSES_SP_NAME(killchar) (NCURSES_SP_ARG);
oldstr = str;
getyx(win, y, x);
}
} else if (ch >= KEY_MIN
|| (maxlen >= 0 && str - oldstr >= maxlen)) {
- beep();
+ NCURSES_SP_NAME(beep) (NCURSES_SP_ARG);
} else {
*str++ = (char) ch;
if (oldecho == TRUE) {
sp->_raw = oldraw;
sp->_cbreak = oldcbreak;
- _nc_set_tty_mode(&buf);
+ NCURSES_SP_NAME(_nc_set_tty_mode) (NCURSES_SP_ARGx &buf);
*str = '\0';
if (ch == ERR)
#include <curses.priv.h>
-MODULE_ID("$Id: lib_mouse.c,v 1.105 2009/02/28 21:09:20 tom Exp $")
+#ifndef CUR
+#define CUR SP_TERMTYPE
+#endif
+
+MODULE_ID("$Id: lib_mouse.c,v 1.107 2009/05/10 00:48:29 tom Exp $")
#include <tic.h>
#define _POSIX_SOURCE
#endif
+#ifndef CUR
+#define CUR SP_TERMTYPE
+#endif
+
#include <term.h> /* clear_screen, cup & friends, cur_term */
#include <tic.h>
-MODULE_ID("$Id: lib_newterm.c,v 1.75 2009/04/18 19:22:08 tom Exp $")
+MODULE_ID("$Id: lib_newterm.c,v 1.77 2009/05/10 00:48:29 tom Exp $")
#ifndef ONLCR /* Allows compilation under the QNX 4.2 OS */
#define ONLCR 0
#include <curses.priv.h>
#include <stddef.h>
-MODULE_ID("$Id: lib_newwin.c,v 1.54 2009/04/18 21:02:34 tom Exp $")
+MODULE_ID("$Id: lib_newwin.c,v 1.57 2009/05/09 23:40:03 tom Exp $")
#define window_is(name) ((sp)->_##name == win)
if (win != 0) {
if (_nc_try_global(curses) == 0) {
q = 0;
- for (each_window(p)) {
+ for (each_window(SP, p)) {
if (&(p->win) == win) {
remove_window_from_screen(win);
if (q == 0)
- _nc_windows = p->next;
+ WindowList(SP) = p->next;
else
q->next = p->next;
if (num_columns == 0)
num_columns = screen_columns(SP_PARM) - begx;
- if ((win = _nc_makenew(num_lines, num_columns, begy, begx, 0)) == 0)
+ win = NCURSES_SP_NAME(_nc_makenew) (NCURSES_SP_ARGx
+ num_lines, num_columns, begy, begx, 0);
+ if (win == 0)
returnWin(0);
for (i = 0; i < num_lines; i++) {
NCURSES_EXPORT(WINDOW *)
derwin(WINDOW *orig, int num_lines, int num_columns, int begy, int begx)
{
+#if NCURSES_SP_FUNCS
+ SCREEN *sp = CURRENT_SCREEN;
+#endif
WINDOW *win;
int i;
int flags = _SUBWIN;
if (orig->_flags & _ISPAD)
flags |= _ISPAD;
- if ((win = _nc_makenew(num_lines, num_columns, orig->_begy + begy,
- orig->_begx + begx, flags)) == 0)
+ win = NCURSES_SP_NAME(_nc_makenew) (NCURSES_SP_ARGx num_lines, num_columns,
+ orig->_begy + begy,
+ orig->_begx + begx, flags);
+ if (win == 0)
returnWin(0);
win->_pary = begy;
WINDOW *win;
bool is_pad = (flags & _ISPAD);
- T((T_CALLED("_nc_makenew(%d,%d,%d,%d)"), num_lines, num_columns, begy, begx));
+ T((T_CALLED("_nc_makenew(%p,%d,%d,%d,%d)"),
+ SP_PARM, num_lines, num_columns, begy, begx));
if (SP_PARM == 0)
returnWin(0);
win->_flags |= _SCROLLWIN;
}
- wp->next = _nc_windows;
+ wp->next = WindowList(SP_PARM);
wp->screen = SP_PARM;
- _nc_windows = wp;
+ WindowList(SP_PARM) = wp;
T((T_CREATE("window %p"), win));
}
return (sp);
}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(WINDOW *)
+_nc_curscr_of(SCREEN *sp)
+{
+ return sp == 0 ? 0 : sp->_curscr;
+}
+
+NCURSES_EXPORT(WINDOW *)
+_nc_newscr_of(SCREEN *sp)
+{
+ return sp == 0 ? 0 : sp->_newscr;
+}
+
+NCURSES_EXPORT(WINDOW *)
+_nc_stdscr_of(SCREEN *sp)
+{
+ return sp == 0 ? 0 : sp->_stdscr;
+}
+#endif
#include <curses.priv.h>
-MODULE_ID("$Id: lib_screen.c,v 1.32 2009/02/15 00:39:13 tom Exp $")
+#ifndef CUR
+#define CUR SP_TERMTYPE
+#endif
+
+MODULE_ID("$Id: lib_screen.c,v 1.34 2009/05/10 00:48:29 tom Exp $")
#define MAX_SIZE 0x3fff /* 16k is big enough for a window or pad */
#include <term.h> /* cur_term */
#include <tic.h>
-MODULE_ID("$Id: lib_set_term.c,v 1.118 2009/02/15 00:39:46 tom Exp $")
+#ifndef CUR
+#define CUR SP_TERMTYPE
+#endif
+
+MODULE_ID("$Id: lib_set_term.c,v 1.122 2009/05/10 00:48:29 tom Exp $")
NCURSES_EXPORT(SCREEN *)
set_term(SCREEN *screenp)
bool filtered,
int slk_format)
{
+#if NCURSES_SP_FUNCS
+ SCREEN *sp = CURRENT_SCREEN;
+#endif
char *env;
int bottom_stolen = 0;
bool support_cookies = USE_XMC_SUPPORT;
def_shell_mode();
def_prog_mode();
- for (rop = ripoff_stack;
- rop != ripoff_sp && (rop - ripoff_stack) < N_RIPS;
+ for (rop = safe_ripoff_stack;
+ rop != safe_ripoff_sp && (rop - safe_ripoff_stack) < N_RIPS;
rop++) {
/* If we must simulate soft labels, grab off the line to be used.
}
}
/* reset the stack */
- ripoff_sp = ripoff_stack;
+ safe_ripoff_sp = safe_ripoff_stack;
T(("creating stdscr"));
assert((SP->_lines_avail + SP->_topstolen + bottom_stolen) == slines);
* off from the top or bottom.
*/
NCURSES_EXPORT(int)
-_nc_ripoffline(int line, int (*init) (WINDOW *, int))
+NCURSES_SP_NAME(_nc_ripoffline) (NCURSES_SP_DCLx
+ int line,
+ int (*init) (WINDOW *, int))
{
T((T_CALLED("_nc_ripoffline(%d, %p)"), line, init));
if (line != 0) {
- if (ripoff_sp == 0)
- ripoff_sp = ripoff_stack;
- if (ripoff_sp >= ripoff_stack + N_RIPS)
+ if (safe_ripoff_sp == 0)
+ safe_ripoff_sp = safe_ripoff_stack;
+ if (safe_ripoff_sp >= safe_ripoff_stack + N_RIPS)
returnCode(ERR);
- ripoff_sp->line = line;
- ripoff_sp->hook = init;
- ripoff_sp++;
+ safe_ripoff_sp->line = line;
+ safe_ripoff_sp->hook = init;
+ safe_ripoff_sp++;
}
returnCode(OK);
}
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+_nc_ripoffline(int line, int (*init) (WINDOW *, int))
+{
+ return NCURSES_SP_NAME(_nc_ripoffline) (CURRENT_SCREEN, line, init);
+}
+#endif
+
NCURSES_EXPORT(int)
NCURSES_SP_NAME(ripoffline) (NCURSES_SP_DCLx
int line,
if (line == 0)
returnCode(OK);
- returnCode(_nc_ripoffline((line < 0) ? -1 : 1, init));
+ returnCode(NCURSES_SP_NAME(_nc_ripoffline) (NCURSES_SP_ARGx
+ (line < 0) ? -1 : 1,
+ init));
}
#if NCURSES_SP_FUNCS
#include <ctype.h>
#include <term.h> /* num_labels, label_*, plab_norm */
-MODULE_ID("$Id: lib_slk.c,v 1.36 2009/02/15 00:33:48 tom Exp $")
+#ifndef CUR
+#define CUR SP_TERMTYPE
+#endif
+
+MODULE_ID("$Id: lib_slk.c,v 1.38 2009/05/10 00:48:29 tom Exp $")
/*
* Free any memory related to soft labels, return an error.
NCURSES_EXPORT(int)
_nc_slk_initialize(WINDOW *stwin, int cols)
{
+#if NCURSES_SP_FUNCS
+ SCREEN *sp = CURRENT_SCREEN;
+#endif
int i, x;
int res = OK;
unsigned max_length;
* 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 2009 *
****************************************************************************/
/*
*/
#include <curses.priv.h>
-MODULE_ID("$Id: lib_slkinit.c,v 1.8 2009/02/15 00:42:36 tom Exp $")
+MODULE_ID("$Id: lib_slkinit.c,v 1.10 2009/05/09 18:32:07 tom Exp $")
NCURSES_EXPORT(int)
NCURSES_SP_NAME(slk_init) (NCURSES_SP_DCLx int format)
{
int code = ERR;
- T((T_CALLED("slk_init(%d)"), format));
- if (format >= 0 && format <= 3 && !_nc_globals.slk_format) {
- _nc_globals.slk_format = 1 + format;
- code = _nc_ripoffline(-SLK_LINES(_nc_globals.slk_format), _nc_slk_initialize);
+ T((T_CALLED("slk_init(%p,%d)"), SP_PARM, format));
+
+ if (SP_PARM && format >= 0 && format <= 3 && !SP_PARM->slk_format &&
+ SP_PARM->_prescreen) {
+ SP_PARM->slk_format = 1 + format;
+ code = NCURSES_SP_NAME(_nc_ripoffline) (NCURSES_SP_ARGx
+ -SLK_LINES(SP_PARM->slk_format),
+ _nc_slk_initialize);
}
returnCode(code);
}
NCURSES_EXPORT(int)
slk_init(int format)
{
- return NCURSES_SP_NAME(slk_init) (CURRENT_SCREEN, format);
+ return NCURSES_SP_NAME(slk_init) (CURRENT_SCREEN_PRE, format);
}
#endif
#include <curses.priv.h>
#include <term.h> /* num_labels, label_*, plab_norm */
-MODULE_ID("$Id: lib_slkrefr.c,v 1.18 2009/02/15 00:33:48 tom Exp $")
+#ifndef CUR
+#define CUR SP_TERMTYPE
+#endif
+
+MODULE_ID("$Id: lib_slkrefr.c,v 1.20 2009/05/10 00:48:29 tom Exp $")
/*
* Paint the info line for the PC style SLK emulation.
static void
slk_intern_refresh(SLK * slk)
{
+#if NCURSES_SP_FUNCS
+ SCREEN *sp = CURRENT_SCREEN;
+#endif
int i;
int fmt = SP->slk_format;
#include <curses.priv.h>
#include <term.h>
-MODULE_ID("$Id: resizeterm.c,v 1.35 2009/04/18 20:32:33 tom Exp $")
+#ifndef CUR
+#define CUR SP_TERMTYPE
+#endif
+
+MODULE_ID("$Id: resizeterm.c,v 1.39 2009/05/10 00:48:29 tom Exp $")
#define stolen_lines (screen_lines - SP->_lines_avail)
static void
show_window_sizes(const char *name)
{
+ SCREEN *sp;
WINDOWLIST *wp;
_nc_lock_global(curses);
- _tracef("%s resizing: %2d x %2d (%2d x %2d)", name, LINES, COLS,
- screen_lines(CURRENT_SCREEN), screen_columns(CURRENT_SCREEN));
- for (each_window(wp)) {
- _tracef(" window %p is %2ld x %2ld at %2ld,%2ld",
- &(wp->win),
- (long) wp->win._maxy + 1,
- (long) wp->win._maxx + 1,
- (long) wp->win._begy,
- (long) wp->win._begx);
+ for (each_screen(sp)) {
+ _tracef("%s resizing: %p: %2d x %2d (%2d x %2d)", name, sp,
+ *(ptrLines(sp)),
+ *(ptrCols(sp)),
+ screen_lines(sp), screen_columns(sp));
+ for (each_window(sp, wp)) {
+ _tracef(" window %p is %2ld x %2ld at %2ld,%2ld",
+ &(wp->win),
+ (long) wp->win._maxy + 1,
+ (long) wp->win._maxx + 1,
+ (long) wp->win._begy,
+ (long) wp->win._begx);
+ }
}
_nc_unlock_global(curses);
}
* structure's size.
*/
NCURSES_EXPORT(bool)
-is_term_resized(int ToLines, int ToCols)
+NCURSES_SP_NAME(is_term_resized) (NCURSES_SP_DCLx int ToLines, int ToCols)
{
- T((T_CALLED("is_term_resized(%d, %d)"), ToLines, ToCols));
+ T((T_CALLED("is_term_resized(%p, %d, %d)"), SP_PARM, ToLines, ToCols));
returnCode(ToLines > 0
&& ToCols > 0
- && (ToLines != screen_lines(CURRENT_SCREEN)
- || ToCols != screen_columns(CURRENT_SCREEN)));
+ && (ToLines != screen_lines(SP_PARM)
+ || ToCols != screen_columns(SP_PARM)));
}
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(bool)
+is_term_resized(int ToLines, int ToCols)
+{
+ return NCURSES_SP_NAME(is_term_resized) (CURRENT_SCREEN, ToLines, ToCols);
+}
+#endif
+
/*
*/
static ripoff_t *
ripoff_t *rop;
if (win != 0) {
+#if NCURSES_SP_FUNCS
+ SCREEN *sp = _nc_screen_of(win);
+#endif
for (each_ripoff(rop)) {
if (rop->win == win && rop->line != 0) {
result = rop;
ripoff_t *rop;
if (win != 0) {
+#if NCURSES_SP_FUNCS
+ SCREEN *sp = _nc_screen_of(win);
+#endif
for (each_ripoff(rop)) {
if (rop->line < 0) {
result -= rop->line;
int depth = 0;
if (cmp != 0) {
+#if NCURSES_SP_FUNCS
+ SCREEN *sp = _nc_screen_of(cmp);
+#endif
WINDOWLIST *wp;
- for (each_window(wp)) {
+ for (each_window(sp, wp)) {
WINDOW *tst = &(wp->win);
if (tst->_parent == cmp) {
depth = 1 + child_depth(tst);
adjust_window(WINDOW *win, int ToLines, int ToCols, int stolen EXTRA_DCLS)
{
int result;
- int bottom = CurLines + SP->_topstolen - stolen;
+ int bottom = CurLines + _nc_screen_of(win)->_topstolen - stolen;
int myLines = win->_maxy + 1;
int myCols = win->_maxx + 1;
ripoff_t *rop = ripped_window(win);
* children, decrease those to fit, then decrease the containing window, etc.
*/
static int
-decrease_size(int ToLines, int ToCols, int stolen EXTRA_DCLS)
+decrease_size(NCURSES_SP_DCLx int ToLines, int ToCols, int stolen EXTRA_DCLS)
{
bool found;
int depth = 0;
WINDOWLIST *wp;
- T((T_CALLED("decrease_size(%d, %d)"), ToLines, ToCols));
+ T((T_CALLED("decrease_size(%p, %d, %d)"), SP_PARM, ToLines, ToCols));
do {
found = FALSE;
TR(TRACE_UPDATE, ("decreasing size of windows to %dx%d, depth=%d",
ToLines, ToCols, depth));
- for (each_window(wp)) {
+ for (each_window(SP_PARM, wp)) {
WINDOW *win = &(wp->win);
if (!(win->_flags & _ISPAD)) {
* parent, increase those to fit, then increase the contained window, etc.
*/
static int
-increase_size(int ToLines, int ToCols, int stolen EXTRA_DCLS)
+increase_size(NCURSES_SP_DCLx int ToLines, int ToCols, int stolen EXTRA_DCLS)
{
bool found;
int depth = 0;
WINDOWLIST *wp;
- T((T_CALLED("increase_size(%d, %d)"), ToLines, ToCols));
+ T((T_CALLED("increase_size(%p, %d, %d)"), SP_PARM, ToLines, ToCols));
do {
found = FALSE;
TR(TRACE_UPDATE, ("increasing size of windows to %dx%d, depth=%d",
ToLines, ToCols, depth));
- for (each_window(wp)) {
+ for (each_window(SP_PARM, wp)) {
WINDOW *win = &(wp->win);
if (!(win->_flags & _ISPAD)) {
* such as ungetch().
*/
NCURSES_EXPORT(int)
-resize_term(int ToLines, int ToCols)
+NCURSES_SP_NAME(resize_term) (NCURSES_SP_DCLx int ToLines, int ToCols)
{
int result = OK EXTRA_ARGS;
int was_stolen;
- T((T_CALLED("resize_term(%d,%d) old(%d,%d)"),
- ToLines, ToCols,
- screen_lines(CURRENT_SCREEN), screen_columns(CURRENT_SCREEN)));
+ T((T_CALLED("resize_term(%p,%d,%d) old(%d,%d)"),
+ SP_PARM, ToLines, ToCols,
+ SP_PARM == 0 ? -1 : screen_lines(SP_PARM),
+ SP_PARM == 0 ? -1 : screen_columns(SP_PARM)));
- if (SP == 0) {
+ if (SP_PARM == 0) {
returnCode(ERR);
}
_nc_lock_global(curses);
- was_stolen = (screen_lines(CURRENT_SCREEN) - SP->_lines_avail);
- if (is_term_resized(ToLines, ToCols)) {
- int myLines = CurLines = screen_lines(CURRENT_SCREEN);
- int myCols = CurCols = screen_columns(CURRENT_SCREEN);
+ was_stolen = (screen_lines(SP_PARM) - SP_PARM->_lines_avail);
+ if (NCURSES_SP_NAME(is_term_resized) (NCURSES_SP_ARGx ToLines, ToCols)) {
+ int myLines = CurLines = screen_lines(SP_PARM);
+ int myCols = CurCols = screen_columns(SP_PARM);
#ifdef TRACE
if (USE_TRACEF(TRACE_UPDATE)) {
_nc_unlock_global(tracef);
}
#endif
- if (ToLines > screen_lines(CURRENT_SCREEN)) {
- increase_size(myLines = ToLines, myCols, was_stolen EXTRA_ARGS);
+ if (ToLines > screen_lines(SP_PARM)) {
+ increase_size(NCURSES_SP_ARGx
+ myLines = ToLines, myCols, was_stolen EXTRA_ARGS);
CurLines = myLines;
CurCols = myCols;
}
- if (ToCols > screen_columns(CURRENT_SCREEN)) {
- increase_size(myLines, myCols = ToCols, was_stolen EXTRA_ARGS);
+ if (ToCols > screen_columns(SP_PARM)) {
+ increase_size(NCURSES_SP_ARGx
+ myLines, myCols = ToCols, was_stolen EXTRA_ARGS);
CurLines = myLines;
CurCols = myCols;
}
if (ToLines < myLines ||
ToCols < myCols) {
- decrease_size(ToLines, ToCols, was_stolen EXTRA_ARGS);
+ decrease_size(NCURSES_SP_ARGx ToLines, ToCols, was_stolen EXTRA_ARGS);
}
- screen_lines(CURRENT_SCREEN) = lines = ToLines;
- screen_columns(CURRENT_SCREEN) = columns = ToCols;
+ screen_lines(SP_PARM) = lines = ToLines;
+ screen_columns(SP_PARM) = columns = ToCols;
- SP->_lines_avail = lines - was_stolen;
+ SP_PARM->_lines_avail = lines - was_stolen;
- if (SP->oldhash) {
- FreeAndNull(SP->oldhash);
+ if (SP_PARM->oldhash) {
+ FreeAndNull(SP_PARM->oldhash);
}
- if (SP->newhash) {
- FreeAndNull(SP->newhash);
+ if (SP_PARM->newhash) {
+ FreeAndNull(SP_PARM->newhash);
}
#ifdef TRACE
if (USE_TRACEF(TRACE_UPDATE)) {
returnCode(result);
}
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+resize_term(int ToLines, int ToCols)
+{
+ int res = ERR;
+ _nc_lock_global(curses);
+ res = NCURSES_SP_NAME(resize_term) (CURRENT_SCREEN, ToLines, ToCols);
+ _nc_unlock_global(curses);
+ return (res);
+}
+#endif
+
/*
* This function reallocates NCURSES window structures. It is invoked in
* response to a SIGWINCH interrupt. Other user-defined windows may also need
* invoked directly from the signal handler.
*/
NCURSES_EXPORT(int)
-resizeterm(int ToLines, int ToCols)
+NCURSES_SP_NAME(resizeterm) (NCURSES_SP_DCLx int ToLines, int ToCols)
{
int result = ERR;
- T((T_CALLED("resizeterm(%d,%d) old(%d,%d)"),
- ToLines, ToCols,
- screen_lines(CURRENT_SCREEN), screen_columns(CURRENT_SCREEN)));
+ T((T_CALLED("resizeterm(%p, %d,%d) old(%d,%d)"),
+ SP_PARM, ToLines, ToCols,
+ SP_PARM == 0 ? -1 : screen_lines(SP_PARM), screen_columns(SP_PARM)));
- if (SP != 0) {
+ if (SP_PARM != 0) {
result = OK;
- SP->_sig_winch = FALSE;
+ SP_PARM->_sig_winch = FALSE;
- if (is_term_resized(ToLines, ToCols)) {
+ if (NCURSES_SP_NAME(is_term_resized) (NCURSES_SP_ARGx ToLines, ToCols)) {
#if USE_SIGWINCH
ripoff_t *rop;
- bool slk_visible = (SP != 0
- && SP->_slk != 0
- && !(SP->_slk->hidden));
+ bool slk_visible = (SP_PARM != 0
+ && SP_PARM->_slk != 0
+ && !(SP_PARM->_slk->hidden));
if (slk_visible) {
slk_clear();
}
#endif
- result = resize_term(ToLines, ToCols);
+ result = NCURSES_SP_NAME(resize_term) (NCURSES_SP_ARGx ToLines, ToCols);
#if USE_SIGWINCH
- safe_ungetch(SP, KEY_RESIZE); /* so application can know this */
- clearok(curscr, TRUE); /* screen contents are unknown */
+ safe_ungetch(SP_PARM, KEY_RESIZE); /* so application can know this */
+ clearok(CurScreen(SP_PARM), TRUE); /* screen contents are unknown */
/* ripped-off lines are a special case: if we did not lengthen
* them, we haven't moved them either. repaint them, too.
* not know which are really on top.
*/
for (each_ripoff(rop)) {
- if (rop->win != stdscr
+ if (rop->win != StdScreen(SP_PARM)
&& rop->win != 0
&& rop->line < 0) {
/* soft-keys are a special case: we _know_ how to repaint them */
if (slk_visible) {
- slk_restore();
- slk_touch();
-
- slk_refresh();
+ NCURSES_SP_NAME(slk_restore) (NCURSES_SP_ARG);
+ NCURSES_SP_NAME(slk_touch) (NCURSES_SP_ARG);
+ NCURSES_SP_NAME(slk_refresh) (NCURSES_SP_ARG);
}
#endif
}
returnCode(result);
}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+resizeterm(int ToLines, int ToCols)
+{
+ return NCURSES_SP_NAME(resizeterm) (CURRENT_SCREEN, ToLines, ToCols);
+}
+#endif
#include <curses.priv.h>
-MODULE_ID("$Id: wresize.c,v 1.29 2008/06/07 13:59:01 tom Exp $")
+MODULE_ID("$Id: wresize.c,v 1.30 2009/05/09 18:37:43 tom Exp $")
static int
cleanup_lines(struct ldat *data, int length)
_nc_lock_global(curses);
- for (each_window(wp)) {
+ for (each_window(SP, wp)) {
WINDOW *tst = &(wp->win);
if (tst->_parent == cmp) {
/*
- * $Id: curses.priv.h,v 1.412 2009/05/02 21:28:57 tom Exp $
+ * $Id: curses.priv.h,v 1.416 2009/05/10 01:01:51 tom Exp $
*
* curses.priv.h
*
#define if_USE_SCROLL_HINTS(stmt) /*nothing*/
#endif
+/*
+ * Terminal drivers...
+ */
+#define USE_TERM_DRIVER 0
+
/*
* Note: ht/cbt expansion flakes out randomly under Linux 1.1.47, but only
* when we're throwing control codes at the screen at high volume. To see
#include <nc_panel.h>
-#define IsPreScreen(sp) (((sp)!=0) && sp->_prescreen)
-#define HasTerminal(sp) (((sp)!=0) && (0!=((sp)->_term)))
-#define IsValidScreen(sp) (HasTerminal(sp) && !sp->_prescreen)
+#define IsPreScreen(sp) (((sp) != 0) && sp->_prescreen)
+#define HasTerminal(sp) (((sp) != 0) && (0 != ((sp)->_term)))
+#define IsValidScreen(sp) (HasTerminal(sp) && !IsPreScreen(sp))
+
#if BROKEN_LINKER || USE_REENTRANT
-#define TerminalOf(sp) ((sp)?((sp)->_term?(sp)->_term:_nc_prescreen._cur_term): _nc_prescreen._cur_term)
+#define CurTerm _nc_prescreen._cur_term
+#else
+#define CurTerm cur_term
+#endif
+
+#if NCURSES_SP_FUNCS
+#define TerminalOf(sp) ((sp) ? ((sp)->_term ? (sp)->_term : CurTerm) : CurTerm)
#else
-#define TerminalOf(sp) ((sp)?((sp)->_term?(sp)->_term:cur_term):cur_term)
+#define TerminalOf(sp) CurTerm
#endif
#include <term.h>
+
+/*
+ * Reduce dependency on cur_term global by using terminfo data from SCREEN's
+ * pointer to this data.
+ */
+#ifdef USE_SP_TERMTYPE
+#undef CUR
+#endif
+
+#define SP_TERMTYPE TerminalOf(sp)->type.
+
#include <term_entry.h>
+
#include <nc_tparm.h>
#if NCURSES_EXT_COLORS && USE_WIDEC_SUPPORT
long tgetent_sequence;
WINDOWLIST *_nc_windowlist;
-#define _nc_windows _nc_globals._nc_windowlist
+#define WindowList(sp) _nc_globals._nc_windowlist
#if USE_HOME_TERMINFO
char *home_terminfo;
char traceatr_color_buf[2][80];
int traceatr_color_sel;
int traceatr_color_last;
-
+#if !defined(USE_PTHREADS) && USE_REENTRANT
+ int nested_tracef;
+#endif
#endif /* TRACE */
#ifdef USE_PTHREADS
#endif
} NCURSES_PRESCREEN;
-#define ripoff_sp _nc_prescreen.rsp
-#define ripoff_stack _nc_prescreen.rippedoff
+/*
+ * Use screen-specific ripoff data (for softkeys) rather than global.
+ */
+#ifdef USE_SP_RIPOFF
+#define safe_ripoff_sp (sp)->rsp
+#define safe_ripoff_stack (sp)->rippedoff
+#else
+#define safe_ripoff_sp _nc_prescreen.rsp
+#define safe_ripoff_stack _nc_prescreen.rippedoff
+#endif
extern NCURSES_EXPORT_VAR(NCURSES_PRESCREEN) _nc_prescreen;
WINDOW *_newscr; /* virtual screen to be updated to */
WINDOW *_stdscr; /* screen's full-window context */
+#define CurScreen(sp) (sp)->_curscr
+#define NewScreen(sp) (sp)->_newscr
+#define StdScreen(sp) (sp)->_stdscr
+
TRIES *_keytry; /* "Try" for use with keypad mode */
TRIES *_key_ok; /* Disabled keys via keyok(,FALSE) */
bool _tried; /* keypad mode was initialized */
int _oldnum_size;
bool _cleanup; /* cleanup after int/quit signal */
- int (*_outch)(int); /* output handler if not putc */
+ NCURSES_SP_OUTC _outch; /* output handler if not putc */
int _legacy_coding; /* see use_legacy_coding() */
char tracechr_buf[40];
char tracemse_buf[TRACEMSE_MAX];
#endif
+#if 0
+ WINDOWLIST* _windowlist;
+#define WindowList(sp) (sp)->_windowlist
+#endif
+ NCURSES_OUTC jump;
+
+ ripoff_t rippedoff[N_RIPS];
+ ripoff_t *rsp;
+
/*
* ncurses/ncursesw are the same up to this point.
*/
sp->_fifohead = -1; \
sp->_endwin = TRUE; \
sp->_cursor = -1; \
- sp->_windowlist = 0; \
+ WindowList(sp) = 0; \
sp->_outch = NCURSES_SP_NAME(_nc_outch); \
sp->jump = 0 \
* Standardize/simplify common loops
*/
#define each_screen(p) p = _nc_screen_chain; p != 0; p = (p)->_next_screen
-#define each_window(p) p = _nc_windows; p != 0; p = (p)->next
-#define each_ripoff(p) p = ripoff_stack; (p - ripoff_stack) < N_RIPS; ++p
+#define each_window(sp,p) p = WindowList(sp); p != 0; p = (p)->next
+#define each_ripoff(p) p = safe_ripoff_stack; (p - safe_ripoff_stack) < N_RIPS; ++p
/*
* Prefixes for call/return points of library function traces. We use these to
__FILE__, __LINE__, \
sp->_cursrow, \
sp->_curscol)); \
- _nc_do_xmc_glitch(chg); \
+ NCURSES_SP_NAME(_nc_do_xmc_glitch)(NCURSES_SP_ARGx chg); \
} \
}
#else
#endif
/* lib_acs.c */
-extern NCURSES_EXPORT(void) _nc_init_acs (void); /* corresponds to traditional 'init_acs()' */
-extern NCURSES_EXPORT(int) _nc_msec_cost (const char *const, int); /* used by 'tack' program */
+extern NCURSES_EXPORT(void) _nc_init_acs (void); /* corresponds to traditional 'init_acs()' */
+extern NCURSES_EXPORT(int) _nc_msec_cost (const char *const, int); /* used by 'tack' program */
/* lib_addch.c */
#if USE_WIDEC_SUPPORT
/* elsewhere ... */
extern NCURSES_EXPORT(ENTRY *) _nc_delink_entry (ENTRY *, TERMTYPE *);
-extern NCURSES_EXPORT(NCURSES_CONST char *) _nc_keyname (SCREEN *, int);
extern NCURSES_EXPORT(SCREEN *) _nc_screen_of (WINDOW *);
extern NCURSES_EXPORT(WINDOW *) _nc_makenew (int, int, int, int, int);
extern NCURSES_EXPORT(char *) _nc_trace_buf (int, size_t);
extern NCURSES_EXPORT(int) _nc_read_termcap_entry (const char *const, TERMTYPE *const);
extern NCURSES_EXPORT(int) _nc_setupscreen (int, int, FILE *, bool, int);
extern NCURSES_EXPORT(int) _nc_timed_wait (SCREEN *, int, int, int * EVENTLIST_2nd(_nc_eventlist *));
-extern NCURSES_EXPORT(void) _nc_do_color (short, short, bool, int (*)(int));
+extern NCURSES_EXPORT(void) _nc_do_color (short, short, bool, NCURSES_OUTC);
extern NCURSES_EXPORT(void) _nc_flush (void);
extern NCURSES_EXPORT(void) _nc_free_and_exit (int) GCC_NORETURN;
extern NCURSES_EXPORT(void) _nc_free_entry (ENTRY *, TERMTYPE *);
#define USE_SETBUF_0 0
-#define NC_BUFFERED(flag) _nc_set_buffer(SP->_ofp, flag)
+#define NC_BUFFERED(sp,flag) NCURSES_SP_NAME(_nc_set_buffer)(NCURSES_SP_ARGx sp->_ofp, flag)
#define NC_OUTPUT(sp) ((sp != 0) ? sp->_ofp : stdout)
extern NCURSES_EXPORT(SCREEN *) _nc_screen (void);
extern NCURSES_EXPORT(int) _nc_alloc_screen (void);
extern NCURSES_EXPORT(void) _nc_set_screen (SCREEN *);
+#define CURRENT_SCREEN _nc_screen()
#else
/* 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_set_screen(sp) SP = sp
#endif
-#define CURRENT_SCREEN SP
-
+#if NCURSES_SP_FUNCS && 0
#define CURRENT_SCREEN_PRE (IsPreScreen(CURRENT_SCREEN) ? CURRENT_SCREEN : new_prescr())
+#else
+#define CURRENT_SCREEN_PRE CURRENT_SCREEN
+#endif
/*
* We don't want to use the lines or columns capabilities internally, because
typedef struct _termInfo
{
- bool caninit;
+ bool caninit;
- bool hascolor;
- bool initcolor;
- bool canchange;
+ bool hascolor;
+ bool initcolor;
+ bool canchange;
- int tabsize;
+ int tabsize;
- int maxcolors;
- int maxpairs;
- int nocolorvideo;
+ int maxcolors;
+ int maxpairs;
+ int nocolorvideo;
- int numlabels;
- int labelwidth;
- int labelheight;
+ int numlabels;
+ int labelwidth;
+ int labelheight;
- const color_t* defaultPalette;
+ const color_t* defaultPalette;
} TerminalInfo;
typedef struct term_driver {
#endif
extern NCURSES_EXPORT_VAR(TERM_DRIVER) _nc_TINFO_DRIVER;
-#define IsTermInfo(sp) TRUE
-#define HasTInfoTerminal(sp) ((0!=TerminalOf(sp)) && IsTermInfo(sp))
+#if USE_TERM_DRIVER
+#define IsTermInfo(sp) (TCBOf(sp) && ((TCBOf(sp)->drv->isTerminfo)))
+#else
+#define IsTermInfo(sp) TRUE
+#endif
+
+#define HasTInfoTerminal(sp) ((0 != TerminalOf(sp)) && IsTermInfo(sp))
#define IsValidTIScreen(sp) (HasTInfoTerminal(sp))
/*
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_scr_init)(SCREEN*,const char*);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_scr_restore)(SCREEN*, const char*);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_scrolln)(SCREEN*, int, int, int, int);
-extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_set_tty_mode)(SCREEN*,TTY*);
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_set_tty_mode)(SCREEN*, TTY*);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_setupscreen)(SCREEN**, int, int, FILE *, bool, int);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_tgetent)(SCREEN*,char*,const char *);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_tigetnum)(SCREEN*,NCURSES_CONST char*);
-extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_tputs)(SCREEN*,const char*,int,int(*)(SCREEN*, int));
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_vid_attr)(SCREEN *, attr_t, short, void *);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_vidputs)(SCREEN*,chtype,int(*) (SCREEN*, int));
-extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_do_color)(SCREEN*, short, short, bool, int (*)(SCREEN*,int));
+extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_do_color)(SCREEN*, short, short, bool, NCURSES_SP_OUTC);
extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_do_xmc_glitch)(SCREEN*, attr_t);
extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_flush)(SCREEN*);
extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_free_and_exit)(SCREEN*, int) GCC_NORETURN;
#define safe_unctrl _nc_unctrl
#define safe_ungetch _nc_ungetch
+extern NCURSES_EXPORT(NCURSES_CONST char *) _nc_keyname (SCREEN *, int);
extern NCURSES_EXPORT(int) _nc_ungetch (SCREEN *, int);
extern NCURSES_EXPORT(NCURSES_CONST char *) _nc_unctrl (SCREEN *, chtype);
#include <term_entry.h>
#include <tic.h>
-MODULE_ID("$Id: comp_scan.c,v 1.83 2008/08/16 19:22:55 tom Exp $")
+MODULE_ID("$Id: comp_scan.c,v 1.84 2009/05/09 16:37:42 tom Exp $")
/*
* Maximum length of string capability we'll accept before raising an error.
#define iswhite(ch) (ch == ' ' || ch == '\t')
-NCURSES_EXPORT_VAR(int)
-_nc_syntax = 0; /* termcap or terminfo? */
-NCURSES_EXPORT_VAR(long)
-_nc_curr_file_pos = 0; /* file offset of current line */
-NCURSES_EXPORT_VAR(long)
-_nc_comment_start = 0; /* start of comment range before name */
-NCURSES_EXPORT_VAR(long)
-_nc_comment_end = 0; /* end of comment range before name */
-NCURSES_EXPORT_VAR(long)
-_nc_start_line = 0; /* start line of current entry */
-
-NCURSES_EXPORT_VAR(struct token)
-_nc_curr_token =
+NCURSES_EXPORT_VAR (int) _nc_syntax = 0; /* termcap or terminfo? */
+NCURSES_EXPORT_VAR (long) _nc_curr_file_pos = 0; /* file offset of current line */
+NCURSES_EXPORT_VAR (long) _nc_comment_start = 0; /* start of comment range before name */
+NCURSES_EXPORT_VAR (long) _nc_comment_end = 0; /* end of comment range before name */
+NCURSES_EXPORT_VAR (long) _nc_start_line = 0; /* start line of current entry */
+
+NCURSES_EXPORT_VAR (struct token) _nc_curr_token =
{
0, 0, 0
};
static char *pushname;
#if NCURSES_EXT_FUNCS
-NCURSES_EXPORT_VAR(bool)
-_nc_disable_period = FALSE; /* used by tic -a option */
+NCURSES_EXPORT_VAR (bool) _nc_disable_period = FALSE; /* used by tic -a option */
#endif
/*****************************************************************************
/* just to get rid of the compiler warning */
type = UNDEF;
if (!silent)
- _nc_warning("Illegal character - '%s'", unctrl((chtype) ch));
+ _nc_warning("Illegal character - '%s'",
+ unctrl((chtype) ch));
}
} /* end else (first_column == FALSE) */
} /* end else (ch != EOF) */
#include <term_entry.h>
-MODULE_ID("$Id: init_keytry.c,v 1.13 2009/04/18 18:53:37 tom Exp $")
+MODULE_ID("$Id: init_keytry.c,v 1.14 2009/05/10 00:48:29 tom Exp $")
/*
** _nc_init_keytry()
* than cur_term.
*/
#undef CUR
-#define CUR (sp->_term)->type.
+#define CUR SP_TERMTYPE
#if BROKEN_LINKER
#undef _nc_tinfo_fkeys
/****************************************************************************
- * Copyright (c) 1998-2007,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 *
#include <curses.priv.h>
#include <term.h> /* ena_acs, acs_chars */
-MODULE_ID("$Id: lib_acs.c,v 1.37 2009/03/21 19:39:23 tom Exp $")
+#ifndef CUR
+#define CUR SP_TERMTYPE
+#endif
+
+MODULE_ID("$Id: lib_acs.c,v 1.39 2009/05/10 00:48:29 tom Exp $")
#if BROKEN_LINKER || USE_REENTRANT
#define MyBuffer _nc_prescreen.real_acs_map
-NCURSES_EXPORT_VAR(chtype *)
-NCURSES_PUBLIC_VAR(acs_map)(void)
+NCURSES_EXPORT(chtype *)
+NCURSES_PUBLIC_VAR(acs_map) (void)
{
if (MyBuffer == 0)
MyBuffer = typeCalloc(chtype, ACS_LEN);
}
#undef MyBuffer
#else
-NCURSES_EXPORT_VAR(chtype) acs_map[ACS_LEN] =
+NCURSES_EXPORT_VAR (chtype) acs_map[ACS_LEN] =
{
0
};
NCURSES_EXPORT(void)
_nc_init_acs(void)
{
+#if NCURSES_SP_FUNCS
+ SCREEN *sp = CURRENT_SCREEN;
+#endif
chtype *fake_map = acs_map;
chtype *real_map = SP != 0 ? SP->_acs_map : fake_map;
int j;
*/
#include <curses.priv.h>
-#include <term.h> /* cur_term, pad_char */
#include <termcap.h> /* ospeed */
#if defined(__FreeBSD__)
#include <sys/param.h>
#undef USE_OLD_TTY
#endif /* USE_OLD_TTY */
-MODULE_ID("$Id: lib_baudrate.c,v 1.28 2009/02/14 21:41:22 tom Exp $")
+MODULE_ID("$Id: lib_baudrate.c,v 1.29 2009/02/21 17:22:13 tom Exp $")
/*
* int
{
int result;
- T((T_CALLED("baudrate()")));
+ T((T_CALLED("baudrate(%p)"), SP_PARM));
/*
* In debugging, allow the environment symbol to override when we're
* that take into account costs that depend on baudrate.
*/
#ifdef TRACE
- if (!isatty(fileno(SP_PARM ? SP_PARM->_ofp : stdout))
+ if (IsValidTIScreen(SP_PARM)
+ && !isatty(fileno(SP_PARM ? SP_PARM->_ofp : stdout))
&& getenv("BAUDRATE") != 0) {
int ret;
if ((ret = _nc_getenv_num("BAUDRATE")) <= 0)
}
#endif
- if (cur_term != 0) {
+ if (IsValidTIScreen(SP_PARM)) {
#ifdef USE_OLD_TTY
- result = cfgetospeed(&cur_term->Nttyb);
+ result = cfgetospeed(&(TerminalOf(SP_PARM)->Nttyb));
ospeed = _nc_ospeed(result);
#else /* !USE_OLD_TTY */
#ifdef TERMIOS
- ospeed = cfgetospeed(&cur_term->Nttyb);
+ ospeed = cfgetospeed(&(TerminalOf(SP_PARM)->Nttyb));
#else
- ospeed = cur_term->Nttyb.sg_ospeed;
+ ospeed = TerminalOf(SP_PARM)->Nttyb.sg_ospeed;
#endif
result = _nc_baudrate(ospeed);
#endif
- cur_term->_baudrate = result;
+ TerminalOf(SP_PARM)->_baudrate = result;
} else {
result = ERR;
}
#include <curses.priv.h>
-MODULE_ID("$Id: lib_has_cap.c,v 1.6 2009/04/18 17:28:45 tom Exp $")
+#ifndef CUR
+#define CUR SP_TERMTYPE
+#endif
+
+MODULE_ID("$Id: lib_has_cap.c,v 1.8 2009/05/10 00:53:52 tom Exp $")
NCURSES_EXPORT(bool)
NCURSES_SP_NAME(has_ic) (NCURSES_SP_DCL0)
#include <curses.priv.h>
-MODULE_ID("$Id: lib_longname.c,v 1.10 2009/02/15 00:48:15 tom Exp $")
+MODULE_ID("$Id: lib_longname.c,v 1.11 2009/02/21 17:18:02 tom Exp $")
+#if USE_REENTRANT
NCURSES_EXPORT(char *)
NCURSES_SP_NAME(longname) (NCURSES_SP_DCL0)
{
+ static char empty[] =
+ {'\0'};
char *ptr;
- T((T_CALLED("longname()")));
+ T((T_CALLED("longname(%p)"), SP_PARM));
- for (ptr = ttytype + strlen(ttytype); ptr > ttytype; ptr--)
- if (*ptr == '|')
- returnPtr(ptr + 1);
-
- returnPtr(ttytype);
+ if (SP_PARM) {
+ for (ptr = SP_PARM->_ttytype + strlen(SP_PARM->_ttytype);
+ ptr > SP_PARM->_ttytype;
+ ptr--)
+ if (*ptr == '|')
+ returnPtr(ptr + 1);
+ returnPtr(SP_PARM->_ttytype);
+ }
+ return empty;
}
#if NCURSES_SP_FUNCS
return NCURSES_SP_NAME(longname) (CURRENT_SCREEN);
}
#endif
+
+#else
+NCURSES_EXPORT(char *)
+longname(void)
+{
+ char *ptr;
+
+ T((T_CALLED("longname()")));
+
+ for (ptr = ttytype + strlen(ttytype);
+ ptr > ttytype;
+ ptr--)
+ if (*ptr == '|')
+ returnPtr(ptr + 1);
+ returnPtr(ttytype);
+}
+#endif
#include <term.h>
-MODULE_ID("$Id: lib_options.c,v 1.61 2009/05/02 21:19:53 tom Exp $")
+#ifndef CUR
+#define CUR SP_TERMTYPE
+#endif
+
+MODULE_ID("$Id: lib_options.c,v 1.63 2009/05/10 00:48:29 tom Exp $")
static int _nc_meta(SCREEN *, bool);
NCURSES_EXPORT(int)
idlok(WINDOW *win, bool flag)
{
+#if NCURSES_SP_FUNCS
+ SCREEN *sp = CURRENT_SCREEN;
+#endif
T((T_CALLED("idlok(%p,%d)"), win, flag));
if (win) {
|| has_key_internal(keycode, tp->sibling));
}
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(has_key) (NCURSES_SP_DCLx int keycode)
+{
+ T((T_CALLED("has_key(%p,%d)"), SP_PARM, keycode));
+ returnCode(SP != 0 ? has_key_internal(keycode, SP_PARM->_keytry) : FALSE);
+}
+
+#if NCURSES_SP_FUNCS
NCURSES_EXPORT(int)
has_key(int keycode)
{
- T((T_CALLED("has_key(%d)"), keycode));
- returnCode(SP != 0 ? has_key_internal(keycode, SP->_keytry) : FALSE);
+ return NCURSES_SP_NAME(has_key) (CURRENT_SCREEN, keycode);
}
+#endif
#endif /* NCURSES_EXT_FUNCS */
/*
* than cur_term.
*/
#undef CUR
-#define CUR (sp->_term)->type.
+#define CUR SP_TERMTYPE
NCURSES_EXPORT(int)
NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_DCLx
/****************************************************************************
- * Copyright (c) 1998-2002,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,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 *
#include <term.h>
-MODULE_ID("$Id: lib_print.c,v 1.16 2006/11/26 00:26:34 tom Exp $")
+#ifndef CUR
+#define CUR SP_TERMTYPE
+#endif
+
+MODULE_ID("$Id: lib_print.c,v 1.18 2009/05/10 00:48:29 tom Exp $")
NCURSES_EXPORT(int)
mcprint(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;
/****************************************************************************
- * Copyright (c) 1998-2007,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 *
#include <term_entry.h>
-MODULE_ID("$Id: lib_termcap.c,v 1.63 2008/08/16 19:22:55 tom Exp $")
+#ifndef CUR
+#define CUR SP_TERMTYPE
+#endif
+
+MODULE_ID("$Id: lib_termcap.c,v 1.65 2009/05/10 00:48:29 tom Exp $")
NCURSES_EXPORT_VAR(char *) UP = 0;
NCURSES_EXPORT_VAR(char *) BC = 0;
NCURSES_EXPORT(int)
tgetent(char *bufp, const char *name)
{
+#if NCURSES_SP_FUNCS
+ SCREEN *sp = CURRENT_SCREEN;
+#endif
int errcode;
int n;
bool found_cache = FALSE;
NCURSES_EXPORT(char *)
tgetstr(NCURSES_CONST char *id, char **area)
{
+#if NCURSES_SP_FUNCS
+ SCREEN *sp = CURRENT_SCREEN;
+#endif
unsigned i;
char *result = NULL;
/****************************************************************************
- * Copyright (c) 1998-2000,2003 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2003,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 *
#include <term_entry.h>
#include <tic.h>
-MODULE_ID("$Id: lib_ti.c,v 1.23 2003/05/24 21:10:28 tom Exp $")
+MODULE_ID("$Id: lib_ti.c,v 1.24 2009/04/18 17:37:50 tom Exp $")
NCURSES_EXPORT(int)
-tigetflag(NCURSES_CONST char *str)
+NCURSES_SP_NAME(tigetflag) (NCURSES_SP_DCLx NCURSES_CONST char *str)
{
unsigned i;
- T((T_CALLED("tigetflag(%s)"), str));
+ T((T_CALLED("tigetflag(%p, %s)"), SP_PARM, str));
- if (cur_term != 0) {
- TERMTYPE *tp = &(cur_term->type);
+ if (HasTInfoTerminal(SP_PARM)) {
+ TERMTYPE *tp = &(TerminalOf(SP_PARM)->type);
for_each_boolean(i, tp) {
const char *capname = ExtBoolname(tp, i, boolnames);
if (!strcmp(str, capname)) {
returnCode(ABSENT_BOOLEAN);
}
+#if NCURSES_SP_FUNCS
NCURSES_EXPORT(int)
-tigetnum(NCURSES_CONST char *str)
+tigetflag(NCURSES_CONST char *str)
+{
+ return NCURSES_SP_NAME(tigetflag) (CURRENT_SCREEN, str);
+}
+#endif
+
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(tigetnum) (NCURSES_SP_DCLx NCURSES_CONST char *str)
{
unsigned i;
- T((T_CALLED("tigetnum(%s)"), str));
+ T((T_CALLED("tigetnum(%p, %s)"), SP_PARM, str));
- if (cur_term != 0) {
- TERMTYPE *tp = &(cur_term->type);
+ if (HasTInfoTerminal(SP_PARM)) {
+ TERMTYPE *tp = &(TerminalOf(SP_PARM)->type);
for_each_number(i, tp) {
const char *capname = ExtNumname(tp, i, numnames);
if (!strcmp(str, capname)) {
returnCode(CANCELLED_NUMERIC); /* Solaris returns a -1 instead */
}
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+tigetnum(NCURSES_CONST char *str)
+{
+ return NCURSES_SP_NAME(tigetnum) (CURRENT_SCREEN, str);
+}
+#endif
+
NCURSES_EXPORT(char *)
-tigetstr(NCURSES_CONST char *str)
+NCURSES_SP_NAME(tigetstr) (NCURSES_SP_DCLx NCURSES_CONST char *str)
{
unsigned i;
- T((T_CALLED("tigetstr(%s)"), str));
+ T((T_CALLED("tigetstr(%p, %s)"), SP_PARM, str));
- 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, strnames);
if (!strcmp(str, capname)) {
returnPtr(CANCELLED_STRING);
}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(char *)
+tigetstr(NCURSES_CONST char *str)
+{
+ return NCURSES_SP_NAME(tigetstr) (CURRENT_SCREEN, str);
+}
+#endif
*/
#include <curses.priv.h>
+
+#ifndef CUR
+#define CUR SP_TERMTYPE
+#endif
+
#include <ctype.h>
#include <term.h> /* padding_baud_rate, xon_xoff */
#include <termcap.h> /* ospeed */
#include <tic.h>
-MODULE_ID("$Id: lib_tputs.c,v 1.70 2009/05/02 20:54:22 tom Exp $")
+MODULE_ID("$Id: lib_tputs.c,v 1.73 2009/05/10 00:54:17 tom Exp $")
NCURSES_EXPORT_VAR(char) PC = 0; /* used by termcap library */
NCURSES_EXPORT_VAR(NCURSES_OSPEED) ospeed = 0; /* used by termcap library */
}
#endif
-static int (*my_outch) (int c) = _nc_outch;
+#if NCURSES_SP_FUNCS
+#define my_outch SP_PARM->_outch
+#else
+static NCURSES_SP_OUTC my_outch = NCURSES_SP_NAME(_nc_outch);
+#endif
NCURSES_EXPORT(int)
NCURSES_SP_NAME(delay_output) (NCURSES_SP_DCLx int ms)
{
- T((T_CALLED("delay_output(%d)"), ms));
+ T((T_CALLED("delay_output(%p,%d)"), SP_PARM, ms));
if (no_pad_char) {
- _nc_flush();
+ NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_ARG);
napms(ms);
} else {
register int nullcount;
nullcount = (ms * _nc_baudrate(ospeed)) / (BAUDBYTE * 1000);
for (_nc_nulls_sent += nullcount; nullcount > 0; nullcount--)
- my_outch(PC);
- if (my_outch == _nc_outch)
- _nc_flush();
+ my_outch(NCURSES_SP_ARGx PC);
+ if (my_outch == NCURSES_SP_NAME(_nc_outch))
+ NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_ARG);
}
returnCode(OK);
}
#endif
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(putp) (NCURSES_SP_DCLx const char *string)
+{
+ return NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
+ string, 1, NCURSES_SP_NAME(_nc_outch));
+}
+
+#if NCURSES_SP_FUNCS
NCURSES_EXPORT(int)
putp(const char *string)
{
- return tputs(string, 1, _nc_outch);
+ return NCURSES_SP_NAME(putp) (CURRENT_SCREEN, string);
}
+#endif
NCURSES_EXPORT(int)
-tputs(const char *string, int affcnt, int (*outc) (int))
+NCURSES_SP_NAME(tputs) (NCURSES_SP_DCLx
+ const char *string,
+ int affcnt,
+ NCURSES_SP_OUTC outc)
{
bool always_delay;
bool normal_delay;
char addrbuf[32];
if (USE_TRACEF(TRACE_TPUTS)) {
- if (outc == _nc_outch)
+ if (outc == NCURSES_SP_NAME(_nc_outch))
(void) strcpy(addrbuf, "_nc_outch");
else
(void) sprintf(addrbuf, "%p", outc);
!xon_xoff
&& padding_baud_rate
#if NCURSES_NO_PADDING
- && !GetNoPadding(SP)
+ && !GetNoPadding(SP_PARM)
#endif
&& (_nc_baudrate(ospeed) >= padding_baud_rate);
}
my_outch = outc; /* redirect delay_output() */
while (*string) {
if (*string != '$')
- (*outc) (*string);
+ (*outc) (NCURSES_SP_ARGx *string);
else {
string++;
if (*string != '<') {
- (*outc) ('$');
+ (*outc) (NCURSES_SP_ARGx '$');
if (*string)
- (*outc) (*string);
+ (*outc) (NCURSES_SP_ARGx *string);
} else {
bool mandatory;
string++;
if ((!isdigit(UChar(*string)) && *string != '.')
|| !strchr(string, '>')) {
- (*outc) ('$');
- (*outc) ('<');
+ (*outc) (NCURSES_SP_ARGx '$');
+ (*outc) (NCURSES_SP_ARGx '<');
continue;
}
&& (always_delay
|| normal_delay
|| mandatory))
- delay_output(number / 10);
+ NCURSES_SP_NAME(delay_output) (NCURSES_SP_ARGx number / 10);
} /* endelse (*string == '<') */
} /* endelse (*string == '$') */
delay_output(trailpad / 10);
#endif /* BSD_TPUTS */
- my_outch = _nc_outch;
+ my_outch = NCURSES_SP_NAME(_nc_outch);
return OK;
}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+_nc_outc_wrapper(SCREEN *sp, int c)
+{
+ if (0 == sp) {
+ return (ERR);
+ } else {
+ return sp->jump(c);
+ }
+}
+
+NCURSES_EXPORT(int)
+tputs(const char *string, int affcnt, int (*outc) (int))
+{
+ SetSafeOutcWrapper(outc);
+ return NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx string, affcnt, _nc_outc_wrapper);
+}
+#endif
#include <curses.priv.h>
#include <term.h> /* cur_term */
-MODULE_ID("$Id: lib_ttyflags.c,v 1.19 2009/02/15 00:33:49 tom Exp $")
+#ifndef CUR
+#define CUR SP_TERMTYPE
+#endif
+
+MODULE_ID("$Id: lib_ttyflags.c,v 1.24 2009/05/10 00:48:29 tom Exp $")
NCURSES_EXPORT(int)
-_nc_get_tty_mode(TTY * buf)
+NCURSES_SP_NAME(_nc_get_tty_mode) (NCURSES_SP_DCLx TTY * buf)
{
int result = OK;
return (result);
}
+#if NCURSES_SP_FUNCS
NCURSES_EXPORT(int)
-_nc_set_tty_mode(TTY * buf)
+_nc_get_tty_mode(TTY * buf)
+{
+ return NCURSES_SP_NAME(_nc_get_tty_mode) (CURRENT_SCREEN, buf);
+}
+#endif
+
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(_nc_set_tty_mode) (NCURSES_SP_DCLx TTY * buf)
{
int result = OK;
if (SET_TTY(cur_term->Filedes, buf) != 0) {
if (errno == EINTR)
continue;
- if ((errno == ENOTTY) && (SP != 0))
- SP->_notty = TRUE;
+ if ((errno == ENOTTY) && (SP_PARM != 0))
+ SP_PARM->_notty = TRUE;
result = ERR;
}
break;
return (result);
}
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+_nc_set_tty_mode(TTY * buf)
+{
+ return NCURSES_SP_NAME(_nc_set_tty_mode) (CURRENT_SCREEN, buf);
+}
+#endif
+
NCURSES_EXPORT(int)
NCURSES_SP_NAME(def_shell_mode) (NCURSES_SP_DCL0)
{
if (SP_PARM) {
if (SP_PARM->_keypad_on)
_nc_keypad(SP_PARM, TRUE);
- NC_BUFFERED(TRUE);
+ NC_BUFFERED(SP_PARM, TRUE);
}
returnCode(OK);
}
if (SP_PARM) {
_nc_keypad(SP_PARM, FALSE);
_nc_flush();
- NC_BUFFERED(FALSE);
+ NC_BUFFERED(SP_PARM, FALSE);
}
returnCode(_nc_set_tty_mode(&cur_term->Ottyb));
}
/****************************************************************************
- * Copyright (c) 1998-2003,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 2008 *
****************************************************************************/
/*
#include <curses.priv.h>
-MODULE_ID("$Id: setbuf.c,v 1.13 2007/05/12 19:04:02 tom Exp $")
+MODULE_ID("$Id: setbuf.c,v 1.14 2009/05/09 23:09:00 tom Exp $")
/*
* If the output file descriptor is connected to a tty (the typical case) it
* buffer. So we disable this by default (there may yet be a workaround).
*/
NCURSES_EXPORT(void)
-_nc_set_buffer(FILE *ofp, bool buffered)
+NCURSES_SP_NAME(_nc_set_buffer) (NCURSES_SP_DCLx FILE *ofp, bool buffered)
{
/* optional optimization hack -- do before any output to ofp */
#if HAVE_SETVBUF || HAVE_SETBUFFER
- if (SP->_buffered != buffered) {
+ if (SP_PARM->_buffered != buffered) {
unsigned buf_len;
char *buf_ptr;
#endif
if (buffered != 0) {
buf_len = min(LINES * (COLS + 6), 2800);
- if ((buf_ptr = SP->_setbuf) == 0) {
+ if ((buf_ptr = SP_PARM->_setbuf) == 0) {
if ((buf_ptr = typeMalloc(char, buf_len)) == NULL)
return;
- SP->_setbuf = buf_ptr;
+ SP_PARM->_setbuf = buf_ptr;
/* Don't try to free this! */
}
#if !USE_SETBUF_0
(void) setbuffer(ofp, buf_ptr, (int) buf_len);
#endif
- SP->_buffered = buffered;
+ SP_PARM->_buffered = buffered;
}
#endif /* HAVE_SETVBUF || HAVE_SETBUFFER */
}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(void)
+_nc_set_buffer(FILE *ofp, bool buffered)
+{
+ return NCURSES_SP_NAME(_nc_set_buffer) (CURRENT_SCREEN, ofp, buffered);
+}
+#endif
#include <curses.priv.h>
-MODULE_ID("$Id: lib_traceatr.c,v 1.65 2009/04/18 18:06:31 tom Exp $")
+#ifndef CUR
+#define CUR SP_TERMTYPE
+#endif
+
+MODULE_ID("$Id: lib_traceatr.c,v 1.66 2009/05/10 00:48:29 tom Exp $")
#define COLOR_OF(c) ((c < 0) ? "default" : (c > 7 ? color_of(c) : colors[c].name))
#include <curses.priv.h>
-MODULE_ID("$Id: hashmap.c,v 1.57 2009/04/18 19:03:50 tom Exp $")
+#ifndef CUR
+#define CUR SP_TERMTYPE
+#endif
+
+MODULE_ID("$Id: hashmap.c,v 1.59 2009/05/10 00:51:57 tom Exp $")
#ifdef HASHDEBUG
*/
#include <curses.priv.h>
-#include <term.h>
#include <ctype.h>
-MODULE_ID("$Id: lib_mvcur.c,v 1.118 2009/05/02 20:38:58 tom Exp $")
+#ifndef CUR
+#define CUR SP_TERMTYPE
+#endif
+
+MODULE_ID("$Id: lib_mvcur.c,v 1.120 2009/05/10 00:52:29 tom Exp $")
#define WANT_CHAR(sp, y, x) (sp)->_newscr->_line[y].text[x] /* desired state */
#define BAUDRATE(sp) cur_term->_baudrate /* bits per second */
normalized_cost(NCURSES_SP_DCLx const char *const cap, int affcnt)
/* compute the effective character-count for an operation (round up) */
{
- int cost = _nc_msec_cost(cap, affcnt);
+ int cost = NCURSES_SP_NAME(_nc_msec_cost) (NCURSES_SP_ARGx cap, affcnt);
if (cost != INFINITY)
cost = (cost + SP_PARM->_char_padding - 1) / SP_PARM->_char_padding;
return cost;
* SCREEN's _endwin to TRUE at window initialization time and let this be
* called by doupdate's return-from-shellout code.
*/
- _nc_mvcur_resume();
+ NCURSES_SP_NAME(_nc_mvcur_resume) (NCURSES_SP_ARG);
}
#if NCURSES_SP_FUNCS
if (usecost != INFINITY) {
TPUTS_TRACE("mvcur");
- tputs(buffer, 1, _nc_outch);
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
+ buffer, 1, NCURSES_SP_NAME(_nc_outch));
SP_PARM->_cursrow = ynew;
SP_PARM->_curscol = xnew;
return (OK);
#define _POSIX_SOURCE
#endif
-MODULE_ID("$Id: lib_tstp.c,v 1.38 2009/04/18 19:36:11 tom Exp $")
+MODULE_ID("$Id: lib_tstp.c,v 1.39 2009/05/09 15:46:20 tom Exp $")
#if defined(SIGTSTP) && (HAVE_SIGACTION || HAVE_SIGVEC)
#define USE_SIGTSTP 1
if (scan->_ofp != 0
&& isatty(fileno(scan->_ofp))) {
scan->_cleanup = TRUE;
- scan->_outch = _nc_outch;
+ scan->_outch = NCURSES_SP_NAME(_nc_outch);
}
set_term(scan);
NCURSES_SP_NAME(endwin) (NCURSES_SP_ARG);
#include <curses.priv.h>
#include <term.h>
-MODULE_ID("$Id: lib_vidattr.c,v 1.53 2009/05/02 22:35:03 tom Exp $")
+#ifndef CUR
+#define CUR SP_TERMTYPE
+#endif
+
+MODULE_ID("$Id: lib_vidattr.c,v 1.56 2009/05/10 00:48:29 tom Exp $")
-#define doPut(mode) TPUTS_TRACE(#mode); tputs(mode, 1, outc)
+#define doPut(mode) \
+ TPUTS_TRACE(#mode); \
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx mode, 1, outc)
#define TurnOn(mask,mode) \
if ((turn_on & mask) && mode) { doPut(mode); }
if ((pair != old_pair) \
|| (fix_pair0 && (pair == 0)) \
|| (reverse ^ ((old_attr & A_REVERSE) != 0))) { \
- _nc_do_color(old_pair, pair, reverse, outc); \
+ NCURSES_SP_NAME(_nc_do_color) (NCURSES_SP_ARGx \
+ old_pair, pair, reverse, outc); \
} \
}
NCURSES_EXPORT(int)
NCURSES_SP_NAME(vidputs) (NCURSES_SP_DCLx
chtype newmode,
- int (*outc) (int))
+ NCURSES_SP_OUTC outc)
{
attr_t turn_on, turn_off;
int pair;
} else if (set_attributes) {
if (turn_on || turn_off) {
TPUTS_TRACE("set_attributes");
- tputs(tparm(set_attributes,
- (newmode & A_STANDOUT) != 0,
- (newmode & A_UNDERLINE) != 0,
- (newmode & A_REVERSE) != 0,
- (newmode & A_BLINK) != 0,
- (newmode & A_DIM) != 0,
- (newmode & A_BOLD) != 0,
- (newmode & A_INVIS) != 0,
- (newmode & A_PROTECT) != 0,
- (newmode & A_ALTCHARSET) != 0), 1, outc);
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
+ tparm(set_attributes,
+ (newmode & A_STANDOUT) != 0,
+ (newmode & A_UNDERLINE) != 0,
+ (newmode & A_REVERSE) != 0,
+ (newmode & A_BLINK) != 0,
+ (newmode & A_DIM) != 0,
+ (newmode & A_BOLD) != 0,
+ (newmode & A_INVIS) != 0,
+ (newmode & A_PROTECT) != 0,
+ (newmode & A_ALTCHARSET) != 0),
+ 1, outc);
PreviousAttr &= ALL_BUT_COLOR;
}
SetColorsIf((pair != 0) || fix_pair0, PreviousAttr);
NCURSES_SP_NAME(vidattr) (NCURSES_SP_DCLx
chtype newmode)
{
- return NCURSES_SP_NAME(vidputs) (NCURSES_SP_ARGx newmode, _nc_outch);
+ return NCURSES_SP_NAME(vidputs) (NCURSES_SP_ARGx
+ newmode,
+ NCURSES_SP_NAME(_nc_outch));
}
#if NCURSES_SP_FUNCS
NCURSES_EXPORT(int)
-vidputs(chtype newmode, int (*outc) (int))
+vidputs(chtype newmode, NCURSES_OUTC outc)
{
- return NCURSES_SP_NAME(vidputs) (CURRENT_SCREEN, newmode, outc);
+ SetSafeOutcWrapper(outc);
+ return NCURSES_SP_NAME(vidputs) (CURRENT_SCREEN, newmode, _nc_outc_wrapper);
}
NCURSES_EXPORT(int)
#include <curses.priv.h>
+#ifndef CUR
+#define CUR SP_TERMTYPE
+#endif
+
#if defined __HAIKU__ && defined __BEOS__
#undef __BEOS__
#endif
#include <ctype.h>
-MODULE_ID("$Id: tty_update.c,v 1.252 2009/05/02 20:52:11 tom Exp $")
+MODULE_ID("$Id: tty_update.c,v 1.255 2009/05/10 00:53:14 tom Exp $")
/*
* This define controls the line-breakout optimization. Every once in a
*/
/* #define POSITION_DEBUG */
-static NCURSES_INLINE NCURSES_CH_T ClrBlank(WINDOW *win);
+static NCURSES_INLINE NCURSES_CH_T ClrBlank(NCURSES_SP_DCLx WINDOW *win);
#if NCURSES_SP_FUNCS
static int ClrBottom(SCREEN *, int total);
****************************************************************************/
static void
-position_check(SCREEN *sp, int expected_y, int expected_x, char *legend)
+position_check(NCURSES_SP_DCLx int expected_y, int expected_x, char *legend)
/* check to see if the real cursor position matches the virtual */
{
char buf[20];
NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_ARG);
memset(buf, '\0', sizeof(buf));
- putp("\033[6n"); /* only works on ANSI-compatibles */
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx "\033[6n"); /* only works on ANSI-compatibles */
NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_ARG);
*(s = buf) = 0;
do {
if (expected_y < 0)
expected_y = y - 1;
if (y - 1 != expected_y || x - 1 != expected_x) {
- beep();
- tputs(tparm("\033[%d;%dH", expected_y + 1, expected_x + 1), 1, _nc_outch);
+ NCURSES_SP_NAME(beep) (NCURSES_SP_ARG);
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
+ tparm("\033[%d;%dH",
+ expected_y + 1,
+ expected_x + 1),
+ 1, NCURSES_SP_NAME(_nc_outch));
_tracef("position seen (%d, %d) doesn't match expected one (%d, %d) in %s",
y - 1, x - 1, expected_y, expected_x, legend);
} else {
* make it work for wide characters.
*/
if (SP_PARM->_outch != 0) {
- SP_PARM->_outch(UChar(ch));
+ SP_PARM->_outch(NCURSES_SP_ARGx UChar(ch));
} else
#endif
{
SP_PARM->_curscol += chlen;
if (char_padding) {
TPUTS_TRACE("char_padding");
- putp(char_padding);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx char_padding);
}
}
} else if (enter_am_mode && exit_am_mode) {
/* we can suppress automargin */
TPUTS_TRACE("exit_am_mode");
- putp(exit_am_mode);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx exit_am_mode);
PutAttrChar(NCURSES_SP_ARGx ch);
SP_PARM->_curscol--;
"exit_am_mode");
TPUTS_TRACE("enter_am_mode");
- putp(enter_am_mode);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx enter_am_mode);
} else if ((enter_insert_mode && exit_insert_mode)
|| insert_character || parm_ich) {
GoTo(NCURSES_SP_ARGx
screen_lines(SP_PARM) - 1,
screen_columns(SP_PARM) - 2);
InsStr(NCURSES_SP_ARGx
- newscr->_line[screen_lines(SP_PARM) - 1].text +
+ NewScreen(SP_PARM)->_line[screen_lines(SP_PARM) - 1].text +
screen_columns(SP_PARM) - 2, 1);
}
}
&& runcount > SP_PARM->_ech_cost + SP_PARM->_cup_ch_cost
&& can_clear_with(NCURSES_SP_ARGx CHREF(ntext0))) {
UpdateAttrs(SP_PARM, ntext0);
- putp(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,
rep_count--;
UpdateAttrs(SP_PARM, ntext0);
- tputs(TPARM_2(repeat_char, CharOf(ntext0), rep_count),
- rep_count, _nc_outch);
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
+ TPARM_2(repeat_char,
+ CharOf(ntext0),
+ rep_count),
+ rep_count,
+ NCURSES_SP_NAME(_nc_outch));
SP_PARM->_curscol += rep_count;
if (wrap_possible)
T((T_CALLED("doupdate()")));
- if (curscr == 0
- || newscr == 0)
+ if (CurScreen(SP_PARM) == 0
+ || NewScreen(SP_PARM) == 0)
returnCode(ERR);
#ifdef TRACE
if (USE_TRACEF(TRACE_UPDATE)) {
- if (curscr->_clear)
+ if (CurScreen(SP_PARM)->_clear)
_tracef("curscr is clear");
else
- _tracedump("curscr", curscr);
- _tracedump("newscr", newscr);
+ _tracedump("curscr", CurScreen(SP_PARM));
+ _tracedump("newscr", NewScreen(SP_PARM));
_nc_unlock_global(tracef);
}
#endif /* TRACE */
for (i = 0; i < screen_lines(SP_PARM); i++) {
for (j = 0; j < screen_columns(SP_PARM); j++) {
bool failed = FALSE;
- NCURSES_CH_T *thisline = newscr->_line[i].text;
+ NCURSES_CH_T *thisline = NewScreen(SP_PARM)->_line[i].text;
attr_t thisattr = AttrOf(thisline[j]) & SP_PARM->_xmc_triggers;
attr_t turnon = thisattr & ~rattr;
/* 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(newscr->_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,
foundit:;
if (end_onscreen) {
- NCURSES_CH_T *lastline = newscr->_line[m].text;
+ NCURSES_CH_T *lastline =
+ NewScreen(SP_PARM)->_line[m].text;
/*
* If there are safely-attributed blanks at the end of
/* 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(newscr->_line[p].text[q]);
+ attr_t testattr =
+ AttrOf(NewScreen(SP_PARM)->_line[p].text[q]);
if ((testattr & SP_PARM->_xmc_triggers) == rattr)
goto foundend;
- RemAttr(newscr->_line[p].text[q], turnon);
+ RemAttr(NewScreen(SP_PARM)->_line[p].text[q], turnon);
}
q = 0;
}
/* show altered highlights after magic-cookie check */
if (USE_TRACEF(TRACE_UPDATE)) {
_tracef("After magic-cookie check...");
- _tracedump("newscr", newscr);
+ _tracedump("newscr", NewScreen(SP_PARM));
_nc_unlock_global(tracef);
}
#endif /* TRACE */
#endif /* USE_XMC_SUPPORT */
nonempty = 0;
- if (curscr->_clear || newscr->_clear) { /* force refresh ? */
+ if (CurScreen(SP_PARM)->_clear || NewScreen(SP_PARM)->_clear) { /* force refresh ? */
ClrUpdate(NCURSES_SP_ARG);
- curscr->_clear = FALSE; /* reset flag */
- newscr->_clear = FALSE; /* reset flag */
+ CurScreen(SP_PARM)->_clear = FALSE; /* reset flag */
+ NewScreen(SP_PARM)->_clear = FALSE; /* reset flag */
} else {
int changedlines = CHECK_INTERVAL;
if (check_pending(NCURSES_SP_ARG))
goto cleanup;
- nonempty = min(screen_lines(SP_PARM), newscr->_maxy + 1);
+ nonempty = min(screen_lines(SP_PARM), NewScreen(SP_PARM)->_maxy + 1);
if (SP_PARM->_scrolling) {
_nc_scroll_optimize();
}
/*
- * 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,
*/
- if (newscr->_line[i].firstchar != _NOCHANGE
- || curscr->_line[i].firstchar != _NOCHANGE) {
+ if (NewScreen(SP_PARM)->_line[i].firstchar != _NOCHANGE
+ || CurScreen(SP_PARM)->_line[i].firstchar != _NOCHANGE) {
TransformLine(NCURSES_SP_ARGx i);
changedlines++;
}
/* mark line changed successfully */
- if (i <= newscr->_maxy) {
- MARK_NOCHANGE(newscr, i);
+ if (i <= NewScreen(SP_PARM)->_maxy) {
+ MARK_NOCHANGE(NewScreen(SP_PARM), i);
}
- if (i <= curscr->_maxy) {
- MARK_NOCHANGE(curscr, i);
+ if (i <= CurScreen(SP_PARM)->_maxy) {
+ MARK_NOCHANGE(CurScreen(SP_PARM), i);
}
}
}
/* put everything back in sync */
- for (i = nonempty; i <= newscr->_maxy; i++) {
- MARK_NOCHANGE(newscr, i);
+ for (i = nonempty; i <= NewScreen(SP_PARM)->_maxy; i++) {
+ MARK_NOCHANGE(NewScreen(SP_PARM), i);
}
- for (i = nonempty; i <= curscr->_maxy; i++) {
- MARK_NOCHANGE(curscr, i);
+ for (i = nonempty; i <= CurScreen(SP_PARM)->_maxy; i++) {
+ MARK_NOCHANGE(CurScreen(SP_PARM), i);
}
- if (!newscr->_leaveok) {
- curscr->_curx = newscr->_curx;
- curscr->_cury = newscr->_cury;
+ if (!NewScreen(SP_PARM)->_leaveok) {
+ CurScreen(SP_PARM)->_curx = NewScreen(SP_PARM)->_curx;
+ CurScreen(SP_PARM)->_cury = NewScreen(SP_PARM)->_cury;
- GoTo(NCURSES_SP_ARGx curscr->_cury, curscr->_curx);
+ GoTo(NCURSES_SP_ARGx CurScreen(SP_PARM)->_cury, CurScreen(SP_PARM)->_curx);
}
cleanup:
UpdateAttrs(SP_PARM, normal);
NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_ARG);
- WINDOW_ATTRS(curscr) = WINDOW_ATTRS(newscr);
+ WINDOW_ATTRS(CurScreen(SP_PARM)) = WINDOW_ATTRS(NewScreen(SP_PARM));
#if USE_TRACE_TIMES
(void) times(&after);
* in the wbkgd() call. Assume 'stdscr' for this case.
*/
#define BCE_ATTRS (A_NORMAL|A_COLOR)
-#define BCE_BKGD(win) (((win) == curscr ? stdscr : (win))->_nc_bkgd)
+#define BCE_BKGD(win) (((win) == CurScreen(SP_PARM) ? StdScreen(SP_PARM) : (win))->_nc_bkgd)
static NCURSES_INLINE NCURSES_CH_T
-ClrBlank(WINDOW *win)
+ClrBlank(NCURSES_SP_DCLx WINDOW *win)
{
NCURSES_CH_T blank = blankchar;
if (back_color_erase)
TR(TRACE_UPDATE, (T_CALLED("ClrUpdate")));
if (0 != SP_PARM) {
int i;
- NCURSES_CH_T blank = ClrBlank(stdscr);
- int nonempty = min(screen_lines(SP_PARM), newscr->_maxy + 1);
+ NCURSES_CH_T blank = ClrBlank(NCURSES_SP_ARGx StdScreen(SP_PARM));
+ int nonempty = min(screen_lines(SP_PARM),
+ NewScreen(SP_PARM)->_maxy + 1);
ClearScreen(NCURSES_SP_ARGx blank);
{
int j;
- if (curscr != 0
+ if (CurScreen(SP_PARM) != 0
&& SP_PARM->_cursrow >= 0) {
for (j = SP_PARM->_curscol; j < screen_columns(SP_PARM); j++) {
if (j >= 0) {
- NCURSES_CH_T *cp = &(curscr->_line[SP_PARM->_cursrow].text[j]);
+ NCURSES_CH_T *cp =
+ &(CurScreen(SP_PARM)->_line[SP_PARM->_cursrow].text[j]);
if (!CharEq(*cp, blank)) {
*cp = blank;
UpdateAttrs(SP_PARM, blank);
TPUTS_TRACE("clr_eol");
if (clr_eol && SP_PARM->_el_cost <= (screen_columns(SP_PARM) - SP_PARM->_curscol)) {
- putp(clr_eol);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx clr_eol);
} else {
int count = (screen_columns(SP_PARM) - SP_PARM->_curscol);
while (count-- > 0)
UpdateAttrs(SP_PARM, blank);
TPUTS_TRACE("clr_eos");
- tputs(clr_eos, screen_lines(SP_PARM) - row, _nc_outch);
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
+ clr_eos,
+ screen_lines(SP_PARM) - row,
+ NCURSES_SP_NAME(_nc_outch));
while (col < screen_columns(SP_PARM))
- curscr->_line[row].text[col++] = blank;
+ CurScreen(SP_PARM)->_line[row].text[col++] = blank;
for (row++; row < screen_lines(SP_PARM); row++) {
for (col = 0; col < screen_columns(SP_PARM); col++)
- curscr->_line[row].text[col] = blank;
+ CurScreen(SP_PARM)->_line[row].text[col] = blank;
}
}
int row;
int col;
int top = total;
- int last = min(screen_columns(SP_PARM), newscr->_maxx + 1);
- NCURSES_CH_T blank = newscr->_line[total - 1].text[last - 1];
+ int last = min(screen_columns(SP_PARM), NewScreen(SP_PARM)->_maxx + 1);
+ NCURSES_CH_T blank = NewScreen(SP_PARM)->_line[total - 1].text[last - 1];
bool ok;
if (clr_eos && can_clear_with(NCURSES_SP_ARGx CHREF(blank))) {
for (row = total - 1; row >= 0; row--) {
for (col = 0, ok = TRUE; ok && col < last; col++) {
- ok = (CharEq(newscr->_line[row].text[col], blank));
+ ok = (CharEq(NewScreen(SP_PARM)->_line[row].text[col], blank));
}
if (!ok)
break;
for (col = 0; ok && col < last; col++) {
- ok = (CharEq(curscr->_line[row].text[col], blank));
+ ok = (CharEq(CurScreen(SP_PARM)->_line[row].text[col], blank));
}
if (!ok)
top = row;
#define xmc_turn_on(sp,a,b) ((((a)^(b)) & ~(a) & (sp)->_xmc_triggers) != 0)
#endif
-#define xmc_new(sp,r,c) newscr->_line[r].text[c]
+#define xmc_new(sp,r,c) NewScreen(SP_PARM)->_line[r].text[c]
#define xmc_turn_off(sp,a,b) xmc_turn_on(sp,b,a)
#endif /* USE_XMC_SUPPORT */
TransformLine(NCURSES_SP_DCLx int const lineno)
{
int firstChar, oLastChar, nLastChar;
- NCURSES_CH_T *newLine = newscr->_line[lineno].text;
- NCURSES_CH_T *oldLine = curscr->_line[lineno].text;
+ NCURSES_CH_T *newLine = NewScreen(SP_PARM)->_line[lineno].text;
+ NCURSES_CH_T *oldLine = CurScreen(SP_PARM)->_line[lineno].text;
int n;
bool attrchanged = FALSE;
if (attrchanged) { /* we may have to disregard the whole line */
GoTo(NCURSES_SP_ARGx lineno, firstChar);
- ClrToEOL(NCURSES_SP_ARGx ClrBlank(curscr), FALSE);
+ ClrToEOL(NCURSES_SP_ARGx
+ ClrBlank(NCURSES_SP_ARGx CurScreen(SP_PARM)),
+ FALSE);
PutRange(NCURSES_SP_ARGx
oldLine, newLine, lineno, 0,
screen_columns(SP_PARM) - 1);
GoTo(NCURSES_SP_ARGx lineno, 0);
UpdateAttrs(SP_PARM, blank);
TPUTS_TRACE("clr_eol");
- putp(clr_eol);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx clr_eol);
} else {
GoTo(NCURSES_SP_ARGx lineno, nFirstChar - 1);
UpdateAttrs(SP_PARM, blank);
TPUTS_TRACE("clr_bol");
- putp(clr_bol);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx clr_bol);
}
while (firstChar < nFirstChar)
#if NCURSES_EXT_FUNCS
if (SP_PARM->_coloron
&& !SP_PARM->_default_color) {
- _nc_do_color(GET_SCREEN_PAIR(SP_PARM), 0, FALSE, _nc_outch);
+ NCURSES_SP_NAME(_nc_do_color) (NCURSES_SP_ARGx
+ GET_SCREEN_PAIR(SP_PARM),
+ 0,
+ FALSE,
+ NCURSES_SP_NAME(_nc_outch));
if (!back_color_erase) {
fast_clear = FALSE;
}
if (clear_screen) {
UpdateAttrs(SP_PARM, blank);
TPUTS_TRACE("clear_screen");
- putp(clear_screen);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx clear_screen);
SP_PARM->_cursrow = SP_PARM->_curscol = 0;
position_check(SP_PARM,
SP_PARM->_cursrow,
UpdateAttrs(SP_PARM, blank);
TPUTS_TRACE("clr_eos");
- tputs(clr_eos, screen_lines(SP_PARM), _nc_outch);
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
+ clr_eos,
+ screen_lines(SP_PARM),
+ NCURSES_SP_NAME(_nc_outch));
} else if (clr_eol) {
SP_PARM->_cursrow = SP_PARM->_curscol = -1;
for (i = 0; i < screen_lines(SP_PARM); i++) {
GoTo(NCURSES_SP_ARGx i, 0);
TPUTS_TRACE("clr_eol");
- putp(clr_eol);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx clr_eol);
}
GoTo(NCURSES_SP_ARGx 0, 0);
}
for (i = 0; i < screen_lines(SP_PARM); i++) {
for (j = 0; j < screen_columns(SP_PARM); j++)
- curscr->_line[i].text[j] = blank;
+ CurScreen(SP_PARM)->_line[i].text[j] = blank;
}
TR(TRACE_UPDATE, ("screen cleared"));
/* The order must match that of InsCharCost. */
if (parm_ich) {
TPUTS_TRACE("parm_ich");
- tputs(TPARM_1(parm_ich, count), count, _nc_outch);
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
+ TPARM_1(parm_ich, count),
+ count,
+ NCURSES_SP_NAME(_nc_outch));
while (count) {
PutAttrChar(NCURSES_SP_ARGx CHREF(*line));
line++;
}
} else if (enter_insert_mode && exit_insert_mode) {
TPUTS_TRACE("enter_insert_mode");
- putp(enter_insert_mode);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx enter_insert_mode);
while (count) {
PutAttrChar(NCURSES_SP_ARGx CHREF(*line));
if (insert_padding) {
TPUTS_TRACE("insert_padding");
- putp(insert_padding);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx insert_padding);
}
line++;
count--;
}
TPUTS_TRACE("exit_insert_mode");
- putp(exit_insert_mode);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx exit_insert_mode);
} else {
while (count) {
TPUTS_TRACE("insert_character");
- putp(insert_character);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx insert_character);
PutAttrChar(NCURSES_SP_ARGx CHREF(*line));
if (insert_padding) {
TPUTS_TRACE("insert_padding");
- putp(insert_padding);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx insert_padding);
}
line++;
count--;
TR(TRACE_UPDATE, ("DelChar(%p, %d) called, position = (%ld,%ld)",
SP_PARM, count,
- (long) newscr->_cury,
- (long) newscr->_curx));
+ (long) NewScreen(SP_PARM)->_cury,
+ (long) NewScreen(SP_PARM)->_curx));
if (parm_dch) {
TPUTS_TRACE("parm_dch");
- tputs(TPARM_1(parm_dch, count), count, _nc_outch);
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
+ TPARM_1(parm_dch, count),
+ count,
+ NCURSES_SP_NAME(_nc_outch));
} else {
for (n = 0; n < count; n++) {
TPUTS_TRACE("delete_character");
- putp(delete_character);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx delete_character);
}
}
}
GoTo(NCURSES_SP_ARGx bot, 0);
UpdateAttrs(SP_PARM, blank);
TPUTS_TRACE("scroll_forward");
- putp(scroll_forward);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx scroll_forward);
} else if (n == 1 && delete_line && bot == maxy) {
GoTo(NCURSES_SP_ARGx top, 0);
UpdateAttrs(SP_PARM, blank);
TPUTS_TRACE("delete_line");
- putp(delete_line);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx delete_line);
} else if (parm_index && top == miny && bot == maxy) {
GoTo(NCURSES_SP_ARGx bot, 0);
UpdateAttrs(SP_PARM, blank);
TPUTS_TRACE("parm_index");
- tputs(TPARM_2(parm_index, n, 0), n, _nc_outch);
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
+ TPARM_2(parm_index, n, 0),
+ n,
+ NCURSES_SP_NAME(_nc_outch));
} else if (parm_delete_line && bot == maxy) {
GoTo(NCURSES_SP_ARGx top, 0);
UpdateAttrs(SP_PARM, blank);
TPUTS_TRACE("parm_delete_line");
- tputs(TPARM_2(parm_delete_line, n, 0), n, _nc_outch);
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
+ TPARM_2(parm_delete_line, n, 0),
+ n,
+ NCURSES_SP_NAME(_nc_outch));
} else if (scroll_forward && top == miny && bot == maxy) {
GoTo(NCURSES_SP_ARGx bot, 0);
UpdateAttrs(SP_PARM, blank);
for (i = 0; i < n; i++) {
TPUTS_TRACE("scroll_forward");
- putp(scroll_forward);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx scroll_forward);
}
} else if (delete_line && bot == maxy) {
GoTo(NCURSES_SP_ARGx top, 0);
UpdateAttrs(SP_PARM, blank);
for (i = 0; i < n; i++) {
TPUTS_TRACE("delete_line");
- putp(delete_line);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx delete_line);
}
} else
return ERR;
GoTo(NCURSES_SP_ARGx top, 0);
UpdateAttrs(SP_PARM, blank);
TPUTS_TRACE("scroll_reverse");
- putp(scroll_reverse);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx scroll_reverse);
} else if (n == 1 && insert_line && bot == maxy) {
GoTo(NCURSES_SP_ARGx top, 0);
UpdateAttrs(SP_PARM, blank);
TPUTS_TRACE("insert_line");
- putp(insert_line);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx insert_line);
} else if (parm_rindex && top == miny && bot == maxy) {
GoTo(NCURSES_SP_ARGx top, 0);
UpdateAttrs(SP_PARM, blank);
TPUTS_TRACE("parm_rindex");
- tputs(TPARM_2(parm_rindex, n, 0), n, _nc_outch);
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
+ TPARM_2(parm_rindex, n, 0),
+ n,
+ NCURSES_SP_NAME(_nc_outch));
} else if (parm_insert_line && bot == maxy) {
GoTo(NCURSES_SP_ARGx top, 0);
UpdateAttrs(SP_PARM, blank);
TPUTS_TRACE("parm_insert_line");
- tputs(TPARM_2(parm_insert_line, n, 0), n, _nc_outch);
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
+ TPARM_2(parm_insert_line, n, 0),
+ n,
+ NCURSES_SP_NAME(_nc_outch));
} else if (scroll_reverse && top == miny && bot == maxy) {
GoTo(NCURSES_SP_ARGx top, 0);
UpdateAttrs(SP_PARM, blank);
for (i = 0; i < n; i++) {
TPUTS_TRACE("scroll_reverse");
- putp(scroll_reverse);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx scroll_reverse);
}
} else if (insert_line && bot == maxy) {
GoTo(NCURSES_SP_ARGx top, 0);
UpdateAttrs(SP_PARM, blank);
for (i = 0; i < n; i++) {
TPUTS_TRACE("insert_line");
- putp(insert_line);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx insert_line);
}
} else
return ERR;
UpdateAttrs(SP_PARM, blank);
if (n == 1 && delete_line) {
TPUTS_TRACE("delete_line");
- putp(delete_line);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx delete_line);
} else if (parm_delete_line) {
TPUTS_TRACE("parm_delete_line");
- tputs(TPARM_2(parm_delete_line, n, 0), n, _nc_outch);
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
+ TPARM_2(parm_delete_line, n, 0),
+ n,
+ NCURSES_SP_NAME(_nc_outch));
} else { /* if (delete_line) */
for (i = 0; i < n; i++) {
TPUTS_TRACE("delete_line");
- putp(delete_line);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx delete_line);
}
}
UpdateAttrs(SP_PARM, blank);
if (n == 1 && insert_line) {
TPUTS_TRACE("insert_line");
- putp(insert_line);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx insert_line);
} else if (parm_insert_line) {
TPUTS_TRACE("parm_insert_line");
- tputs(TPARM_2(parm_insert_line, n, 0), n, _nc_outch);
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
+ TPARM_2(parm_insert_line, n, 0),
+ n,
+ NCURSES_SP_NAME(_nc_outch));
} else { /* if (insert_line) */
for (i = 0; i < n; i++) {
TPUTS_TRACE("insert_line");
- putp(insert_line);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx insert_line);
}
}
int maxy)
/* scroll region from top to bot by n lines */
{
- NCURSES_CH_T blank = ClrBlank(stdscr);
+ NCURSES_CH_T blank = ClrBlank(NCURSES_SP_ARGx StdScreen(SP_PARM));
int i;
bool cursor_saved = FALSE;
int res;
&& save_cursor && restore_cursor) {
cursor_saved = TRUE;
TPUTS_TRACE("save_cursor");
- putp(save_cursor);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx save_cursor);
}
TPUTS_TRACE("change_scroll_region");
- putp(TPARM_2(change_scroll_region, top, bot));
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx
+ TPARM_2(change_scroll_region, top, bot));
if (cursor_saved) {
TPUTS_TRACE("restore_cursor");
- putp(restore_cursor);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx restore_cursor);
} else {
SP_PARM->_cursrow = SP_PARM->_curscol = -1;
}
res = scroll_csr_forward(NCURSES_SP_ARGx n, top, bot, top, bot, blank);
TPUTS_TRACE("change_scroll_region");
- putp(TPARM_2(change_scroll_region, 0, maxy));
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx
+ TPARM_2(change_scroll_region, 0, maxy));
SP_PARM->_cursrow = SP_PARM->_curscol = -1;
}
&& save_cursor && restore_cursor) {
cursor_saved = TRUE;
TPUTS_TRACE("save_cursor");
- putp(save_cursor);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx save_cursor);
}
TPUTS_TRACE("change_scroll_region");
- putp(TPARM_2(change_scroll_region, top, bot));
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx
+ TPARM_2(change_scroll_region, top, bot));
if (cursor_saved) {
TPUTS_TRACE("restore_cursor");
- putp(restore_cursor);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx restore_cursor);
} else {
SP_PARM->_cursrow = SP_PARM->_curscol = -1;
}
-n, top, bot, top, bot, blank);
TPUTS_TRACE("change_scroll_region");
- putp(TPARM_2(change_scroll_region, 0, maxy));
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx
+ TPARM_2(change_scroll_region, 0, maxy));
SP_PARM->_cursrow = SP_PARM->_curscol = -1;
}
if (res == ERR)
return (ERR);
- _nc_scroll_window(curscr, n, top, bot, blank);
+ _nc_scroll_window(CurScreen(SP_PARM), n, top, bot, blank);
/* shift hash values too - they can be reused */
NCURSES_SP_NAME(_nc_scroll_oldhash) (NCURSES_SP_ARGx n, top, bot);
/* make sure terminal is in a sane known state */
SetAttr(SCREEN_ATTRS(SP_PARM), A_NORMAL);
- newscr->_clear = TRUE;
+ NewScreen(SP_PARM)->_clear = TRUE;
/* reset color pairs and definitions */
if (SP_PARM->_coloron || SP_PARM->_color_defs)
}
if (exit_attribute_mode)
- putp(exit_attribute_mode);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx exit_attribute_mode);
else {
/* turn off attributes */
if (exit_alt_charset_mode)
- putp(exit_alt_charset_mode);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx exit_alt_charset_mode);
if (exit_standout_mode)
- putp(exit_standout_mode);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx exit_standout_mode);
if (exit_underline_mode)
- putp(exit_underline_mode);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx exit_underline_mode);
}
if (exit_insert_mode)
- putp(exit_insert_mode);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx exit_insert_mode);
if (enter_am_mode && exit_am_mode)
- putp(auto_right_margin ? enter_am_mode : exit_am_mode);
+ NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx
+ (auto_right_margin
+ ? enter_am_mode
+ : exit_am_mode));
}
#if NCURSES_SP_FUNCS
&& !SP_PARM->_default_color) {
static const NCURSES_CH_T blank = NewChar(BLANK_TEXT);
SP_PARM->_default_color = TRUE;
- _nc_do_color(-1, 0, FALSE, _nc_outch);
+ NCURSES_SP_NAME(_nc_do_color) (NCURSES_SP_ARGx
+ -1, 0,
+ FALSE,
+ NCURSES_SP_NAME(_nc_outch));
SP_PARM->_default_color = FALSE;
mvcur(SP_PARM->_cursrow,
#include <curses.priv.h>
#include <term.h>
-MODULE_ID("$Id: lib_vid_attr.c,v 1.7 2009/05/02 23:30:44 tom Exp $")
+#ifndef CUR
+#define CUR SP_TERMTYPE
+#endif
+
+MODULE_ID("$Id: lib_vid_attr.c,v 1.11 2009/05/10 00:48:29 tom Exp $")
-#define doPut(mode) TPUTS_TRACE(#mode); tputs(mode, 1, outc)
+#define doPut(mode) TPUTS_TRACE(#mode); NCURSES_SP_NAME(tputs)(NCURSES_SP_ARGx mode, 1, outc)
#define TurnOn(mask,mode) \
if ((turn_on & mask) && mode) { doPut(mode); }
if ((pair != old_pair) \
|| (fix_pair0 && (pair == 0)) \
|| (reverse ^ ((old_attr & A_REVERSE) != 0))) { \
- _nc_do_color(old_pair, pair, reverse, outc); \
+ NCURSES_SP_NAME(_nc_do_color) (NCURSES_SP_ARGx \
+ old_pair, pair, \
+ reverse, outc); \
} \
}
#define set_color(mode, pair) mode &= ALL_BUT_COLOR; mode |= COLOR_PAIR(pair)
NCURSES_EXPORT(int)
-NCURSES_SP_NAME(vid_puts)(NCURSES_SP_DCLx
- attr_t newmode,
- short pair,
- void *opts GCC_UNUSED,
- int (*outc) (int))
+NCURSES_SP_NAME(vid_puts) (NCURSES_SP_DCLx
+ attr_t newmode,
+ short pair,
+ void *opts GCC_UNUSED,
+ NCURSES_SP_OUTC outc)
{
#if NCURSES_EXT_COLORS
static attr_t previous_attr = A_NORMAL;
} else if (set_attributes) {
if (turn_on || turn_off) {
TPUTS_TRACE("set_attributes");
- tputs(TPARM_9(set_attributes,
- (newmode & A_STANDOUT) != 0,
- (newmode & A_UNDERLINE) != 0,
- (newmode & A_REVERSE) != 0,
- (newmode & A_BLINK) != 0,
- (newmode & A_DIM) != 0,
- (newmode & A_BOLD) != 0,
- (newmode & A_INVIS) != 0,
- (newmode & A_PROTECT) != 0,
- (newmode & A_ALTCHARSET) != 0), 1, outc);
+ NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
+ TPARM_9(set_attributes,
+ (newmode & A_STANDOUT) != 0,
+ (newmode & A_UNDERLINE) != 0,
+ (newmode & A_REVERSE) != 0,
+ (newmode & A_BLINK) != 0,
+ (newmode & A_DIM) != 0,
+ (newmode & A_BOLD) != 0,
+ (newmode & A_INVIS) != 0,
+ (newmode & A_PROTECT) != 0,
+ (newmode & A_ALTCHARSET) != 0),
+ 1, outc);
previous_attr &= ALL_BUT_COLOR;
previous_pair = 0;
}
#else
T((T_CALLED("vid_puts(%s,%d)"), _traceattr(newmode), pair));
set_color(newmode, pair);
- returnCode(vidputs(newmode, outc));
+ returnCode(NCURSES_SP_NAME(vidputs) (NCURSES_SP_ARGx newmode, outc));
#endif
}
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+vid_puts(attr_t newmode,
+ short pair,
+ void *opts GCC_UNUSED,
+ NCURSES_OUTC outc)
+{
+ SetSafeOutcWrapper(outc);
+ return NCURSES_SP_NAME(vid_puts) (CURRENT_SCREEN,
+ newmode,
+ pair,
+ opts,
+ _nc_outc_wrapper);
+}
+#endif
+
#undef vid_attr
NCURSES_EXPORT(int)
NCURSES_SP_NAME(vid_attr) (NCURSES_SP_DCLx
void *opts)
{
T((T_CALLED("vid_attr(%s,%d)"), _traceattr(newmode), pair));
- returnCode(vid_puts(newmode, pair, opts, _nc_outch));
+ returnCode(NCURSES_SP_NAME(vid_puts) (NCURSES_SP_ARGx
+ newmode,
+ pair,
+ opts,
+ NCURSES_SP_NAME(_nc_outch)));
}
#if NCURSES_SP_FUNCS
-NCURSES_EXPORT(int)
-vid_puts(attr_t newmode, short pair, void *opts GCC_UNUSED, int (*outc) (int))
-{
- return NCURSES_SP_NAME(vid_puts) (CURRENT_SCREEN, newmode, pair, opts, outc);
-}
-
NCURSES_EXPORT(int)
vid_attr(attr_t newmode, short pair, void *opts)
{
* we can use termattrs() for part of the logic.
*/
NCURSES_EXPORT(attr_t)
-term_attrs(void)
+NCURSES_SP_NAME(term_attrs) (NCURSES_SP_DCL0)
{
attr_t attrs;
T((T_CALLED("term_attrs()")));
- attrs = termattrs();
+ attrs = SP_PARM ? NCURSES_SP_NAME(termattrs) (NCURSES_SP_ARG) : 0;
/* these are only supported for wide-character mode */
if (enter_horizontal_hl_mode)
returnAttr(attrs);
}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(attr_t)
+term_attrs(void)
+{
+ return NCURSES_SP_NAME(term_attrs) (CURRENT_SCREEN);
+}
+#endif