./ncurses/tty/lib_tstp.c
./ncurses/tty/lib_twait.c
./ncurses/tty/lib_vidattr.c
-./ncurses/tty/tty_display.h
-./ncurses/tty/tty_input.h
./ncurses/tty/tty_update.c
./ncurses/wcwidth.h
./ncurses/widechar/charable.c
./test/test_instr.c
./test/test_inwstr.c
./test/test_opaque.c
+./test/test_vid_puts.c
+./test/test_vidputs.c
./test/testaddch.c
./test/testcurs.c
./test/testscanw.c
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
-------------------------------------------------------------------------------
--- $Id: NEWS,v 1.2008 2013/01/05 23:28:30 tom Exp $
+-- $Id: NEWS,v 1.2010 2013/01/12 18:12:21 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.
+20130112
+ + correct prototype in manpage for vid_puts.
+ + drop ncurses/tty/tty_display.h, ncurses/tty/tty_input.h, since they
+ are unused in the current driver model.
+ + modify mvcur to use stdout except when called within the ncurses
+ library.
+ + modify vidattr and vid_attr to use stdout as documented in manpage.
+ + amend changes made to buffering in 20120825 so that the low-level
+ putp() call uses stdout rather than ncurses' internal buffering.
+ The putp_sp() call does the same, for consistency (Redhat #892674).
+
20130105
+ add "-s" option to test/view.c to allow it to start in single-step
mode, reducing size of trace files when it is used for debugging
# use or other dealings in this Software without prior written #
# authorization. #
##############################################################################
-# $Id: dist.mk,v 1.908 2013/01/05 14:08:17 tom Exp $
+# $Id: dist.mk,v 1.909 2013/01/12 14:34:58 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 = 9
-NCURSES_PATCH = 20130105
+NCURSES_PATCH = 20130112
# We don't append the patch to the version, since this only applies to releases
VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
.\"***************************************************************************
-.\" Copyright (c) 1999-2010,2011 Free Software Foundation, Inc. *
+.\" Copyright (c) 1999-2011,2013 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 *
.\" authorization. *
.\"***************************************************************************
.\"
-.\" $Id: curs_terminfo.3x,v 1.36 2011/12/17 23:31:40 tom Exp $
+.\" $Id: curs_terminfo.3x,v 1.37 2013/01/12 18:11:40 tom Exp $
.TH curs_terminfo 3X ""
.ds n 5
.na
.br
\fBint vidattr(chtype \fR\fIattrs\fR\fB);\fR
.br
-\fBint vid_puts(attr_t \fR\fIattrs\fR\fB, short \fR\fIpair\fR\fB, void *\fR\fIopts\fR\fB, int (*\fR\fIputc\fR\fB)(char));\fR
+\fBint vid_puts(attr_t \fR\fIattrs\fR\fB, short \fR\fIpair\fR\fB, void *\fR\fIopts\fR\fB, int (*\fR\fIputc\fR\fB)(int));\fR
.br
\fBint vid_attr(attr_t \fR\fIattrs\fR\fB, short \fR\fIpair\fR\fB, void *\fR\fIopts\fR\fB);\fR
.br
/****************************************************************************
- * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2013 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 *
#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: lib_beep.c,v 1.15 2009/10/24 22:02:14 tom Exp $")
+MODULE_ID("$Id: lib_beep.c,v 1.16 2013/01/12 17:26:25 tom Exp $")
/*
* beep()
if (cur_term == 0) {
res = ERR;
} else if (bell) {
- TPUTS_TRACE("bell");
- res = putp(bell);
- _nc_flush();
+ res = NCURSES_PUTP2_FLUSH("bell", bell);
} else if (flash_screen) {
- TPUTS_TRACE("flash_screen");
- res = putp(flash_screen);
+ res = NCURSES_PUTP2_FLUSH("flash_screen", flash_screen);
_nc_flush();
}
#endif
/****************************************************************************
- * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2012,2013 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 *
#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: lib_color.c,v 1.106 2012/12/15 19:14:34 tom Exp $")
+MODULE_ID("$Id: lib_color.c,v 1.107 2013/01/12 17:25:36 tom Exp $")
#ifdef USE_TERM_DRIVER
#define CanChange InfoOf(SP_PARM).canchange
(void) SP_PARM;
if (orig_pair != 0) {
- TPUTS_TRACE("orig_pair");
- putp(orig_pair);
+ (void) NCURSES_PUTP2("orig_pair", orig_pair);
result = TRUE;
}
return result;
result = CallDriver(SP_PARM, rescolors);
#else
if (orig_colors != 0) {
- TPUTS_TRACE("orig_colors");
- putp(orig_colors);
+ NCURSES_PUTP2("orig_colors", orig_colors);
result = TRUE;
}
#endif
tp[f].red, tp[f].green, tp[f].blue,
tp[b].red, tp[b].green, tp[b].blue));
- TPUTS_TRACE("initialize_pair");
- putp(TPARM_7(initialize_pair,
- pair,
- tp[f].red, tp[f].green, tp[f].blue,
- tp[b].red, tp[b].green, tp[b].blue));
+ NCURSES_PUTP2("initialize_pair",
+ TPARM_7(initialize_pair,
+ pair,
+ tp[f].red, tp[f].green, tp[f].blue,
+ tp[b].red, tp[b].green, tp[b].blue));
}
#endif
#ifdef USE_TERM_DRIVER
CallDriver_4(SP_PARM, initcolor, color, r, g, b);
#else
- TPUTS_TRACE("initialize_color");
- putp(TPARM_4(initialize_color, color, r, g, b));
+ NCURSES_PUTP2("initialize_color",
+ TPARM_4(initialize_color, color, r, g, b));
#endif
SP_PARM->_color_defs = max(color + 1, SP_PARM->_color_defs);
/****************************************************************************
- * Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2011,2013 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 *
#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: lib_flash.c,v 1.12 2011/05/28 21:53:45 tom Exp $")
+MODULE_ID("$Id: lib_flash.c,v 1.13 2013/01/12 17:26:07 tom Exp $")
/*
* flash()
if (HasTerminal(SP_PARM)) {
/* FIXME: should make sure that we are not in altchar mode */
if (flash_screen) {
- TPUTS_TRACE("flash_screen");
- res = putp(flash_screen);
- _nc_flush();
+ res = NCURSES_PUTP2_FLUSH("flash_screen", flash_screen);
} else if (bell) {
- TPUTS_TRACE("bell");
- res = putp(bell);
- _nc_flush();
+ res = NCURSES_PUTP2_FLUSH("bell", bell);
}
}
#endif
/****************************************************************************
- * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2012,2013 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 *
#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: lib_mouse.c,v 1.139 2012/07/21 23:30:50 tom Exp $")
+MODULE_ID("$Id: lib_mouse.c,v 1.140 2013/01/12 16:35:34 tom Exp $")
#include <tic.h>
#if USE_EMX_MOUSE
sp->_emxmouse_activated = enable;
#else
- NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx
- "xterm-mouse",
- TPARM_1(sp->_mouse_xtermcap, enable));
+ NCURSES_PUTP2("xterm-mouse", TPARM_1(sp->_mouse_xtermcap, enable));
#endif
sp->_mouse_active = enable;
}
/****************************************************************************
- * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2012,2013 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 *
#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: lib_slkrefr.c,v 1.28 2012/12/08 22:31:14 tom Exp $")
+MODULE_ID("$Id: lib_slkrefr.c,v 1.29 2013/01/12 17:25:48 tom Exp $")
#ifdef USE_TERM_DRIVER
#define NumLabels InfoOf(SP_PARM).numlabels
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));
+ NCURSES_PUTP2("plab_norm",
+ TPARM_2(plab_norm,
+ i + 1,
+ slk->ent[i].form_text));
}
#endif
} else {
CallDriver_1(sp, hwlabelOnOff, slk->hidden ? FALSE : TRUE);
#else
if (slk->hidden) {
- TPUTS_TRACE("label_off");
- putp(label_off);
+ NCURSES_PUTP2("label_off", label_off);
} else {
- TPUTS_TRACE("label_on");
- putp(label_on);
+ NCURSES_PUTP2("label_on", label_on);
}
#endif
}
/****************************************************************************
- * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2012,2013 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 *
****************************************************************************/
/*
- * $Id: curses.priv.h,v 1.515 2012/12/22 21:20:22 tom Exp $
+ * $Id: curses.priv.h,v 1.521 2013/01/12 21:53:35 tom Exp $
*
* curses.priv.h
*
#define SET_WINDOW_PAIR(w,p) (w)->_color = (p)
#define SameAttrOf(a,b) (AttrOf(a) == AttrOf(b) && GetPair(a) == GetPair(b))
-#if NCURSES_SP_FUNCS
-#define VIDATTR(sp,attr,pair) NCURSES_SP_NAME(vid_attr)(sp, attr, (short) pair, 0)
-#else
-#define VIDATTR(sp,attr,pair) vid_attr(attr, (short) pair, 0)
-#endif
+#define VIDATTR(sp,attr,pair) NCURSES_SP_NAME(vid_puts)(NCURSES_SP_ARGx attr, (short) pair, 0, NCURSES_OUTC_FUNC)
#else /* !NCURSES_EXT_COLORS */
WINDOW_ATTRS(w) |= (A_COLOR & (attr_t) ColorPair(p))
#define SameAttrOf(a,b) (AttrOf(a) == AttrOf(b))
-#if NCURSES_SP_FUNCS
-#define VIDATTR(sp,attr,pair) NCURSES_SP_NAME(vidattr)(sp, attr)
-#else
-#define VIDATTR(sp,attr,pair) vidattr(attr)
-#endif
+#define VIDATTR(sp,attr,pair) NCURSES_SP_NAME(vidputs)(NCURSES_SP_ARGx attr, NCURSES_OUTC_FUNC)
#endif /* NCURSES_EXT_COLORS */
+#define NCURSES_OUTC_FUNC NCURSES_SP_NAME(_nc_outch)
+#define NCURSES_PUTP2(name,value) NCURSES_SP_NAME(_nc_putp)(NCURSES_SP_ARGx name, value)
+#define NCURSES_PUTP2_FLUSH(name,value) NCURSES_SP_NAME(_nc_putp_flush)(NCURSES_SP_ARGx name, value)
+
#if NCURSES_NO_PADDING
#define GetNoPadding(sp) ((sp) ? (sp)->_no_padding : _nc_prescreen._no_padding)
#define SetNoPadding(sp) _nc_set_no_padding(sp)
sp->_endwin = TRUE; \
sp->_cursor = -1; \
WindowList(sp) = 0; \
- sp->_outch = NCURSES_SP_NAME(_nc_outch); \
+ sp->_outch = NCURSES_OUTC_FUNC; \
sp->jump = 0 \
/* usually in <limits.h> */
#define PUTC_INIT init_mb (PUT_st)
#define PUTC(ch) do { if(!isWidecExt(ch)) { \
if (Charable(ch)) { \
- NCURSES_SP_NAME(_nc_outch) (NCURSES_SP_ARGx CharOf(ch)); \
+ NCURSES_OUTC_FUNC (NCURSES_SP_ARGx CharOf(ch)); \
COUNT_OUTCHARS(1); \
} else { \
PUTC_INIT; \
(ch).chars[PUTC_i], &PUT_st); \
if (PUTC_n <= 0) { \
if (PUTC_ch && is8bits(PUTC_ch) && PUTC_i == 0) \
- NCURSES_SP_NAME(_nc_outch) (NCURSES_SP_ARGx CharOf(ch)); \
+ NCURSES_OUTC_FUNC (NCURSES_SP_ARGx CharOf(ch)); \
break; \
} else { \
int PUTC_j; \
for (PUTC_j = 0; PUTC_j < PUTC_n; ++PUTC_j) { \
- NCURSES_SP_NAME(_nc_outch) (NCURSES_SP_ARGx PUTC_buf[PUTC_j]); \
+ NCURSES_OUTC_FUNC (NCURSES_SP_ARGx PUTC_buf[PUTC_j]); \
} \
} \
} \
#define ARG_CH_T NCURSES_CH_T
#define CARG_CH_T NCURSES_CH_T
#define PUTC_DATA /* nothing */
-#define PUTC(ch) NCURSES_SP_NAME(_nc_outch) (NCURSES_SP_ARGx (int) ch)
+#define PUTC(ch) NCURSES_OUTC_FUNC (NCURSES_SP_ARGx (int) ch)
#define BLANK (' '|A_NORMAL)
#define ZEROS ('\0'|A_NORMAL)
/* lib_mvcur.c */
#define INFINITY 1000000 /* cost: too high to use */
+extern NCURSES_EXPORT(int) _nc_mvcur(int yold, int xold, int ynew, int xnew);
+
extern NCURSES_EXPORT(void) _nc_mvcur_init (void);
extern NCURSES_EXPORT(void) _nc_mvcur_resume (void);
extern NCURSES_EXPORT(void) _nc_mvcur_wrap (void);
extern NCURSES_EXPORT(int) _nc_keypad (SCREEN *, int);
extern NCURSES_EXPORT(int) _nc_ospeed (int);
extern NCURSES_EXPORT(int) _nc_outch (int);
+extern NCURSES_EXPORT(int) _nc_putchar (int);
extern NCURSES_EXPORT(int) _nc_putp(const char *, const char *);
extern NCURSES_EXPORT(int) _nc_putp_flush(const char *, const char *);
extern NCURSES_EXPORT(int) _nc_read_termcap_entry (const char *const, TERMTYPE *const);
#else
#define TINFO_HAS_KEY NCURSES_SP_NAME(has_key)
#define TINFO_DOUPDATE NCURSES_SP_NAME(doupdate)
-#define TINFO_MVCUR NCURSES_SP_NAME(mvcur)
+#define TINFO_MVCUR NCURSES_SP_NAME(_nc_mvcur)
#endif
/*
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_get_tty_mode)(SCREEN*,TTY*);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_mcprint)(SCREEN*,char*, int);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_msec_cost)(SCREEN*, const char *, int);
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_mvcur)(SCREEN*, int, int, int, int);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_outch)(SCREEN*, int);
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_putchar)(SCREEN*, int);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_putp)(SCREEN*, const char *, const char*);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_putp_flush)(SCREEN*, const char *, const char *);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_resetty)(SCREEN*);
/****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2010,2013 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 *
#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: lib_acs.c,v 1.43 2010/12/25 23:00:45 tom Exp $")
+MODULE_ID("$Id: lib_acs.c,v 1.44 2013/01/12 17:24:42 tom Exp $")
#if BROKEN_LINKER || USE_REENTRANT
#define MyBuffer _nc_prescreen.real_acs_map
CallDriver_2(SP_PARM, initacs, real_map, fake_map);
#else
if (ena_acs != NULL) {
- TPUTS_TRACE("ena_acs");
- putp(ena_acs);
+ NCURSES_PUTP2("ena_acs", ena_acs);
}
#if NCURSES_EXT_FUNCS
/*
/****************************************************************************
- * Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2011,2013 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 *
#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: lib_options.c,v 1.72 2011/10/22 16:31:35 tom Exp $")
+MODULE_ID("$Id: lib_options.c,v 1.74 2013/01/12 16:44:17 tom Exp $")
NCURSES_EXPORT(int)
idlok(WINDOW *win, bool flag)
#ifdef USE_TERM_DRIVER
if (IsTermInfo(sp)) {
if (flag) {
- NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "meta_on", meta_on);
+ NCURSES_PUTP2("meta_on", meta_on);
} else {
- NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "meta_off", meta_off);
+ NCURSES_PUTP2("meta_off", meta_off);
}
}
#else
if (flag) {
- NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "meta_on", meta_on);
+ NCURSES_PUTP2("meta_on", meta_on);
} else {
- NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "meta_off", meta_off);
+ NCURSES_PUTP2("meta_off", meta_off);
}
#endif
result = OK;
if (!bBuiltIn) {
switch (vis) {
case 2:
- code = NCURSES_SP_NAME(_nc_putp_flush) (NCURSES_SP_ARGx
- "cursor_visible",
- cursor_visible);
+ code = NCURSES_PUTP2_FLUSH("cursor_visible",
+ cursor_visible);
break;
case 1:
- code = NCURSES_SP_NAME(_nc_putp_flush) (NCURSES_SP_ARGx
- "cursor_normal",
- cursor_normal);
+ code = NCURSES_PUTP2_FLUSH("cursor_normal",
+ cursor_normal);
break;
case 0:
- code = NCURSES_SP_NAME(_nc_putp_flush) (NCURSES_SP_ARGx
- "cursor_invisible",
- cursor_invisible);
+ code = NCURSES_PUTP2_FLUSH("cursor_invisible",
+ cursor_invisible);
break;
}
} else
NCURSES_SP_NAME(_nc_putp_flush) (NCURSES_SP_DCLx
const char *name, const char *value)
{
- int rc = NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx name, value);
+ int rc = NCURSES_PUTP2(name, value);
if (rc != ERR) {
_nc_flush();
}
sp->_keypad_on = flag;
#else
if (flag) {
- (void) NCURSES_SP_NAME(_nc_putp_flush) (NCURSES_SP_ARGx
- "keypad_xmit",
- keypad_xmit);
+ (void) NCURSES_PUTP2_FLUSH("keypad_xmit", keypad_xmit);
} else if (!flag && keypad_local) {
- (void) NCURSES_SP_NAME(_nc_putp_flush) (NCURSES_SP_ARGx
- "keypad_local",
- keypad_local);
+ (void) NCURSES_PUTP2_FLUSH("keypad_local", keypad_local);
}
if (flag && !sp->_tried) {
/****************************************************************************
- * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2012,2013 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 <termcap.h> /* ospeed */
#include <tic.h>
-MODULE_ID("$Id: lib_tputs.c,v 1.88 2012/12/08 20:01:20 tom Exp $")
+MODULE_ID("$Id: lib_tputs.c,v 1.93 2013/01/12 20:57:32 tom Exp $")
NCURSES_EXPORT_VAR(char) PC = 0; /* used by termcap library */
NCURSES_EXPORT_VAR(NCURSES_OSPEED) ospeed = 0; /* used by termcap library */
}
#endif
+/*
+ * This is used for the putp special case.
+ */
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(_nc_putchar) (NCURSES_SP_DCLx int ch)
+{
+ (void) SP_PARM;
+ return putchar(ch);
+}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+_nc_putchar(int ch)
+{
+ return putchar(ch);
+}
+#endif
+
+/*
+ * putp is special - per documentation it calls tputs with putchar as the
+ * parameter for outputting characters. This means that it uses stdio, which
+ * is not signal-safe. Applications call this entrypoint; we do not call it
+ * from within the library.
+ */
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));
+ string, 1, NCURSES_SP_NAME(_nc_putchar));
+}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+putp(const char *string)
+{
+ return NCURSES_SP_NAME(putp) (CURRENT_SCREEN, string);
}
+#endif
+/*
+ * Use these entrypoints rather than "putp" within the library.
+ */
NCURSES_EXPORT(int)
NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_DCLx
const char *name GCC_UNUSED,
if (string != 0) {
TPUTS_TRACE(name);
- rc = NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx string);
+ rc = NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
+ string, 1, NCURSES_SP_NAME(_nc_outch));
}
return rc;
}
#if NCURSES_SP_FUNCS
-NCURSES_EXPORT(int)
-putp(const char *string)
-{
- return NCURSES_SP_NAME(putp) (CURRENT_SCREEN, string);
-}
-
NCURSES_EXPORT(int)
_nc_putp(const char *name, const char *string)
{
# endif
#endif
-MODULE_ID("$Id: tinfo_driver.c,v 1.26 2013/01/05 23:25:36 tom Exp $")
+MODULE_ID("$Id: tinfo_driver.c,v 1.29 2013/01/12 22:01:43 tom Exp $")
/*
* SCO defines TIOCGSIZE and the corresponding struct. Other systems (SunOS,
/* FIXME: should make sure that we are not in altchar mode */
if (beepFlag) {
if (bell) {
- res = NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "bell", bell);
+ res = NCURSES_PUTP2("bell", bell);
NCURSES_SP_NAME(_nc_flush) (sp);
} else if (flash_screen) {
- res = NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx
- "flash_screen",
- flash_screen);
+ res = NCURSES_PUTP2("flash_screen", flash_screen);
NCURSES_SP_NAME(_nc_flush) (sp);
}
} else {
if (flash_screen) {
- res = NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx
- "flash_screen",
- flash_screen);
+ res = NCURSES_PUTP2("flash_screen", flash_screen);
NCURSES_SP_NAME(_nc_flush) (sp);
} else if (bell) {
- res = NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "bell", bell);
+ res = NCURSES_PUTP2("bell", bell);
NCURSES_SP_NAME(_nc_flush) (sp);
}
}
SetSP();
if (orig_pair != 0) {
- NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "orig_pair", orig_pair);
+ NCURSES_PUTP2("orig_pair", orig_pair);
result = TRUE;
}
return result;
SetSP();
if (orig_colors != 0) {
- NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "orig_colors", orig_colors);
+ NCURSES_PUTP2("orig_colors", orig_colors);
result = TRUE;
}
return result;
tp[f].red, tp[f].green, tp[f].blue,
tp[b].red, tp[b].green, tp[b].blue));
- NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx
- "initialize_pair",
- TPARM_7(initialize_pair,
- pair,
- tp[f].red, tp[f].green, tp[f].blue,
- tp[b].red, tp[b].green, tp[b].blue));
+ NCURSES_PUTP2("initialize_pair",
+ TPARM_7(initialize_pair,
+ pair,
+ tp[f].red, tp[f].green, tp[f].blue,
+ tp[b].red, tp[b].green, tp[b].blue));
}
}
AssertTCB();
if (initialize_color != NULL) {
- NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx
- "initialize_color",
- TPARM_4(initialize_color, color, r, g, b));
+ NCURSES_PUTP2("initialize_color",
+ TPARM_4(initialize_color, color, r, g, b));
}
}
{
SCREEN *sp = TCB->csp;
AssertTCB();
- return TINFO_MVCUR(sp, yold, xold, ynew, xnew);
+ return NCURSES_SP_NAME(_nc_mvcur) (sp, yold, xold, ynew, xnew);
}
static void
AssertTCB();
if (labnum > 0 && labnum <= num_labels) {
- NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx
- "plab_norm",
- TPARM_2(plab_norm, labnum, text));
+ NCURSES_PUTP2("plab_norm",
+ TPARM_2(plab_norm, labnum, text));
}
}
AssertTCB();
if (OnFlag) {
- NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "label_on", label_on);
+ NCURSES_PUTP2("label_on", label_on);
} else {
- NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "label_off", label_off);
+ NCURSES_PUTP2("label_off", label_off);
}
}
AssertTCB();
assert(sp != 0);
if (ena_acs != NULL) {
- NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx "ena_acs", ena_acs);
+ NCURSES_PUTP2("ena_acs", ena_acs);
}
#if NCURSES_EXT_FUNCS
/*
int rc = ERR;
if (value) {
- rc = NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx name, value);
+ rc = NCURSES_PUTP2(name, value);
}
return rc;
}
/****************************************************************************
- * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2012,2013 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 *
#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: lib_mvcur.c,v 1.128 2012/12/15 20:59:27 tom Exp $")
+MODULE_ID("$Id: lib_mvcur.c,v 1.131 2013/01/12 22:21:29 tom Exp $")
#define WANT_CHAR(sp, y, x) NewScreen(sp)->_line[y].text[x] /* desired state */
static float diff;
#endif /* MAIN */
+#undef NCURSES_OUTC_FUNC
+#define NCURSES_OUTC_FUNC myOutCh
+
#define OPT_SIZE 512
static int normalized_cost(NCURSES_SP_DCLx const char *const cap, int affcnt);
/* Set the scroll-region to a known state (the default) */
{
if (change_scroll_region) {
- NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx
- "change_scroll_region",
- TPARM_2(change_scroll_region,
- 0, screen_lines(SP_PARM) - 1));
+ NCURSES_PUTP2("change_scroll_region",
+ TPARM_2(change_scroll_region,
+ 0, screen_lines(SP_PARM) - 1));
}
}
/* initialize screen for cursor access */
if (enter_ca_mode) {
- NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx
- "enter_ca_mode",
- enter_ca_mode);
+ NCURSES_PUTP2("enter_ca_mode", enter_ca_mode);
}
/*
}
if (exit_ca_mode) {
- NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx
- "exit_ca_mode",
- exit_ca_mode);
+ NCURSES_PUTP2("exit_ca_mode", exit_ca_mode);
}
/*
* Reset terminal's tab counter. There's a long-time bug that
return (ERR);
}
-NCURSES_EXPORT(int)
-TINFO_MVCUR(NCURSES_SP_DCLx int yold, int xold, int ynew, int xnew)
-/* optimized cursor move from (yold, xold) to (ynew, xnew) */
+/*
+ * optimized cursor move from (yold, xold) to (ynew, xnew)
+ */
+static int
+_nc_real_mvcur(NCURSES_SP_DCLx
+ int yold, int xold,
+ int ynew, int xnew,
+ NCURSES_SP_OUTC myOutCh)
{
NCURSES_CH_T oldattr;
int code;
if (l > 0) {
if (carriage_return) {
- NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx
- "carriage_return",
- carriage_return);
+ NCURSES_PUTP2("carriage_return", carriage_return);
} else
NCURSES_SP_NAME(_nc_outch) (NCURSES_SP_ARGx '\r');
xold = 0;
while (l > 0) {
if (newline) {
- NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx
- "newline",
- newline);
+ NCURSES_PUTP2("newline", newline);
} else
NCURSES_SP_NAME(_nc_outch) (NCURSES_SP_ARGx '\n');
l--;
returnCode(code);
}
-#if NCURSES_SP_FUNCS && !defined(USE_TERM_DRIVER)
+/*
+ * These entrypoints are used within the library.
+ */
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(_nc_mvcur) (NCURSES_SP_DCLx
+ int yold, int xold,
+ int ynew, int xnew)
+{
+ return _nc_real_mvcur(NCURSES_SP_ARGx yold, xold, ynew, xnew,
+ NCURSES_SP_NAME(_nc_outch));
+}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+_nc_mvcur(int yold, int xold,
+ int ynew, int xnew)
+{
+ return NCURSES_SP_NAME(_nc_mvcur) (CURRENT_SCREEN, yold, xold, ynew, xnew);
+}
+#endif
+
+#if defined(USE_TERM_DRIVER)
+/*
+ * The terminal driver does not support the external "mvcur()".
+ */
+NCURSES_EXPORT(int)
+TINFO_MVCUR(NCURSES_SP_DCLx int yold, int xold, int ynew, int xnew)
+{
+ return _nc_real_mvcur(NCURSES_SP_ARGx
+ yold, xold,
+ ynew, xnew,
+ NCURSES_SP_NAME(_nc_outch));
+}
+
+#else /* !USE_TERM_DRIVER */
+
+/*
+ * These entrypoints support users of the library.
+ */
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(mvcur) (NCURSES_SP_DCLx int yold, int xold, int ynew,
+ int xnew)
+{
+ return _nc_real_mvcur(NCURSES_SP_ARGx
+ yold, xold,
+ ynew, xnew,
+ NCURSES_SP_NAME(_nc_putchar));
+}
+
+#if NCURSES_SP_FUNCS
NCURSES_EXPORT(int)
mvcur(int yold, int xold, int ynew, int xnew)
{
return NCURSES_SP_NAME(mvcur) (CURRENT_SCREEN, yold, xold, ynew, xnew);
}
#endif
+#endif /* USE_TERM_DRIVER */
#if defined(TRACE) || defined(NCURSES_TEST)
NCURSES_EXPORT_VAR(int) _nc_optimize_enable = OPTIMIZE_ALL;
/****************************************************************************
- * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2011,2013 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 *
#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: lib_vidattr.c,v 1.62 2011/05/28 21:22:04 tom Exp $")
+MODULE_ID("$Id: lib_vidattr.c,v 1.63 2013/01/12 18:00:54 tom Exp $")
#define doPut(mode) \
TPUTS_TRACE(#mode); \
T((T_CALLED("vidattr(%p,%s)"), (void *) SP_PARM, _traceattr(newmode)));
returnCode(NCURSES_SP_NAME(vidputs) (NCURSES_SP_ARGx
newmode,
- NCURSES_SP_NAME(_nc_outch)));
+ NCURSES_SP_NAME(_nc_putchar)));
}
#if NCURSES_SP_FUNCS
+++ /dev/null
-/****************************************************************************
- * Copyright (c) 1998-2003,2004 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 *
- * "Software"), to deal in the Software without restriction, including *
- * without limitation the rights to use, copy, modify, merge, publish, *
- * distribute, distribute with modifications, sublicense, and/or sell *
- * copies of the Software, and to permit persons to whom the Software is *
- * furnished to do so, subject to the following conditions: *
- * *
- * The above copyright notice and this permission notice shall be included *
- * in all copies or substantial portions of the Software. *
- * *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
- * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
- * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
- * *
- * Except as contained in this notice, the name(s) of the above copyright *
- * holders shall not be used in advertising or otherwise to promote the *
- * sale, use or other dealings in this Software without prior written *
- * authorization. *
- ************************************************************************** */
-
-#ifndef TTY_DISPLAY_H
-#define TTY_DISPLAY_H 1
-
-/*
- * $Id: tty_display.h,v 1.6 2005/01/01 23:41:12 tom Exp $
- */
-extern NCURSES_EXPORT(bool) _nc_tty_beep (void);
-extern NCURSES_EXPORT(bool) _nc_tty_check_resize (void);
-extern NCURSES_EXPORT(bool) _nc_tty_cursor (int);
-extern NCURSES_EXPORT(bool) _nc_tty_flash (void);
-extern NCURSES_EXPORT(bool) _nc_tty_init_color (int,int,int,int);
-extern NCURSES_EXPORT(bool) _nc_tty_init_pair (int,int,int);
-extern NCURSES_EXPORT(bool) _nc_tty_slk_hide (bool);
-extern NCURSES_EXPORT(bool) _nc_tty_slk_update (int,const char *);
-extern NCURSES_EXPORT(bool) _nc_tty_start_color (void);
-extern NCURSES_EXPORT(void) _nc_tty_display_resume (void);
-extern NCURSES_EXPORT(void) _nc_tty_display_suspend (void);
-extern NCURSES_EXPORT(void) _nc_tty_dispose (void); /* frees SP->_term */
-extern NCURSES_EXPORT(void) _nc_tty_switch_to (void);
-extern NCURSES_EXPORT(void) _nc_tty_update (void);
-
-struct tty_display_data {
- int _fifohold; /* set if breakout marked */
- unsigned long _current_attr; /* terminal attribute current set */
- int _cursrow; /* physical cursor row (-1=unknown) */
- int _curscol; /* physical cursor column */
-
- /* cursor movement costs; units are 10ths of milliseconds */
- int _char_padding; /* cost of character put */
- int _cr_cost; /* cost of (carriage_return) */
- int _cup_cost; /* cost of (cursor_address) */
- int _home_cost; /* cost of (cursor_home) */
- int _ll_cost; /* cost of (cursor_to_ll) */
-#if USE_HARD_TABS
- int _ht_cost; /* cost of (tab) */
- int _cbt_cost; /* cost of (backtab) */
-#endif /* USE_HARD_TABS */
- int _cub1_cost; /* cost of (cursor_left) */
- int _cuf1_cost; /* cost of (cursor_right) */
- int _cud1_cost; /* cost of (cursor_down) */
- int _cuu1_cost; /* cost of (cursor_up) */
- int _cub_cost; /* cost of (parm_cursor_left) */
- int _cuf_cost; /* cost of (parm_cursor_right) */
- int _cud_cost; /* cost of (parm_cursor_down) */
- int _cuu_cost; /* cost of (parm_cursor_up) */
- int _hpa_cost; /* cost of (column_address) */
- int _vpa_cost; /* cost of (row_address) */
- /* used in lib_doupdate.c, must be chars */
- int _ed_cost; /* cost of (clr_eos) */
- int _el_cost; /* cost of (clr_eol) */
- int _el1_cost; /* cost of (clr_bol) */
- int _dch1_cost; /* cost of (delete_character) */
- int _ich1_cost; /* cost of (insert_character) */
- int _dch_cost; /* cost of (parm_dch) */
- int _ich_cost; /* cost of (parm_ich) */
- int _ech_cost; /* cost of (erase_chars) */
- int _rep_cost; /* cost of (repeat_char) */
- int _hpa_ch_cost; /* cost of (column_address) */
- int _cup_ch_cost; /* cost of (cursor_address) */
- int _smir_cost; /* cost of (enter_insert_mode) */
- int _rmir_cost; /* cost of (exit_insert_mode) */
- int _ip_cost; /* cost of (insert_padding) */
- /* used in lib_mvcur.c */
- char * _address_cursor;
- int _carriage_return_length;
- int _cursor_home_length;
- int _cursor_to_ll_length;
-
- chtype _xmc_suppress; /* attributes to suppress if xmc */
- chtype _xmc_triggers; /* attributes to process if xmc */
-
- bool _sig_winch;
-};
-
-
-#define DelCharCost(count) \
- ((parm_dch != 0) \
- ? D->_dch_cost \
- : ((delete_character != 0) \
- ? (D->_dch1_cost * count) \
- : INFINITY))
-
-#define InsCharCost(count) \
- ((parm_ich != 0) \
- ? D->_ich_cost \
- : ((enter_insert_mode && exit_insert_mode) \
- ? D->_smir_cost + D->_rmir_cost + (D->_ip_cost * count) \
- : ((insert_character != 0) \
- ? ((D->_ich1_cost + D->_ip_cost) * count) \
- : INFINITY)))
-
-#if USE_XMC_SUPPORT
-#define UpdateAttrs(c) if (!SameAttrOf(D->_current_attr, AttrOf(c))) { \
- attr_t chg = D->_current_attr; \
- vidattr(AttrOf(c)); \
- if (magic_cookie_glitch > 0 \
- && XMC_CHANGES((chg ^ D->_current_attr))) { \
- T(("%s @%d before glitch %d,%d", \
- __FILE__, __LINE__, \
- D->_cursrow, \
- D->_curscol)); \
- _nc_do_xmc_glitch(chg); \
- } \
- }
-#else
-#define UpdateAttrs(c) if (!SameAttrOf(D->_current_attr, AttrOf(c))) \
- vidattr(AttrOf(c));
-#endif
-
-#define XMC_CHANGES(c) ((c) & D->_xmc_suppress)
-
-#endif /* TTY_DISPLAY_H */
/****************************************************************************
- * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2012,2013 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 <ctype.h>
-MODULE_ID("$Id: tty_update.c,v 1.273 2012/12/22 21:38:17 tom Exp $")
+MODULE_ID("$Id: tty_update.c,v 1.274 2013/01/12 17:24:22 tom Exp $")
/*
* This define controls the line-breakout optimization. Every once in a
NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_ARG);
memset(buf, '\0', sizeof(buf));
- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx "\033[6n"); /* only works on ANSI-compatibles */
- NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_ARG);
+ NCURSES_PUTP2_FLUSH("cpr", "\033[6n"); /* only works on ANSI-compatibles */
*(s = buf) = 0;
do {
int ask = sizeof(buf) - 1 - (s - buf);
#endif
SP_PARM->_curscol += chlen;
if (char_padding) {
- TPUTS_TRACE("char_padding");
- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx char_padding);
+ NCURSES_PUTP2("char_padding", char_padding);
}
}
PutAttrChar(NCURSES_SP_ARGx ch);
} else if (enter_am_mode && exit_am_mode) {
/* we can suppress automargin */
- TPUTS_TRACE("exit_am_mode");
- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx exit_am_mode);
+ NCURSES_PUTP2("exit_am_mode", exit_am_mode);
PutAttrChar(NCURSES_SP_ARGx ch);
SP_PARM->_curscol--;
SP_PARM->_curscol,
"exit_am_mode");
- TPUTS_TRACE("enter_am_mode");
- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx enter_am_mode);
+ NCURSES_PUTP2("enter_am_mode", enter_am_mode);
} else if ((enter_insert_mode && exit_insert_mode)
|| insert_character || parm_ich) {
GoTo(NCURSES_SP_ARGx
&& 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_PUTP2("erase_chars", TPARM_1(erase_chars, runcount));
/*
* If this is the last part of the given interval,
if (needclear) {
UpdateAttrs(SP_PARM, blank);
- TPUTS_TRACE("clr_eol");
if (clr_eol && SP_PARM->_el_cost <= (screen_columns(SP_PARM) - SP_PARM->_curscol)) {
- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx clr_eol);
+ NCURSES_PUTP2("clr_eol", clr_eol);
} else {
int count = (screen_columns(SP_PARM) - SP_PARM->_curscol);
while (count-- > 0)
&& SP_PARM->_el_cost <= SP_PARM->_el1_cost) {
GoTo(NCURSES_SP_ARGx lineno, 0);
UpdateAttrs(SP_PARM, blank);
- TPUTS_TRACE("clr_eol");
- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx clr_eol);
+ NCURSES_PUTP2("clr_eol", clr_eol);
} else {
GoTo(NCURSES_SP_ARGx lineno, nFirstChar - 1);
UpdateAttrs(SP_PARM, blank);
- TPUTS_TRACE("clr_bol");
- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx clr_bol);
+ NCURSES_PUTP2("clr_bol", clr_bol);
}
while (firstChar < nFirstChar)
if (fast_clear) {
if (clear_screen) {
UpdateAttrs(SP_PARM, blank);
- TPUTS_TRACE("clear_screen");
- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx clear_screen);
+ NCURSES_PUTP2("clear_screen", clear_screen);
SP_PARM->_cursrow = SP_PARM->_curscol = 0;
position_check(SP_PARM,
SP_PARM->_cursrow,
UpdateAttrs(SP_PARM, blank);
for (i = 0; i < screen_lines(SP_PARM); i++) {
GoTo(NCURSES_SP_ARGx i, 0);
- TPUTS_TRACE("clr_eol");
- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx clr_eol);
+ NCURSES_PUTP2("clr_eol", clr_eol);
}
GoTo(NCURSES_SP_ARGx 0, 0);
}
count--;
}
} else if (enter_insert_mode && exit_insert_mode) {
- TPUTS_TRACE("enter_insert_mode");
- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx enter_insert_mode);
+ NCURSES_PUTP2("enter_insert_mode", enter_insert_mode);
while (count) {
PutAttrChar(NCURSES_SP_ARGx CHREF(*line));
if (insert_padding) {
- TPUTS_TRACE("insert_padding");
- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx insert_padding);
+ NCURSES_PUTP2("insert_padding", insert_padding);
}
line++;
count--;
}
- TPUTS_TRACE("exit_insert_mode");
- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx exit_insert_mode);
+ NCURSES_PUTP2("exit_insert_mode", exit_insert_mode);
} else {
while (count) {
- TPUTS_TRACE("insert_character");
- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx insert_character);
+ NCURSES_PUTP2("insert_character", insert_character);
PutAttrChar(NCURSES_SP_ARGx CHREF(*line));
if (insert_padding) {
- TPUTS_TRACE("insert_padding");
- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx insert_padding);
+ NCURSES_PUTP2("insert_padding", insert_padding);
}
line++;
count--;
NCURSES_SP_NAME(_nc_outch));
} else {
for (n = 0; n < count; n++) {
- TPUTS_TRACE("delete_character");
- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx delete_character);
+ NCURSES_PUTP2("delete_character", delete_character);
}
}
}
if (n == 1 && scroll_forward && top == miny && bot == maxy) {
GoTo(NCURSES_SP_ARGx bot, 0);
UpdateAttrs(SP_PARM, blank);
- TPUTS_TRACE("scroll_forward");
- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx scroll_forward);
+ NCURSES_PUTP2("scroll_forward", scroll_forward);
} else if (n == 1 && delete_line && bot == maxy) {
GoTo(NCURSES_SP_ARGx top, 0);
UpdateAttrs(SP_PARM, blank);
- TPUTS_TRACE("delete_line");
- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx delete_line);
+ NCURSES_PUTP2("delete_line", delete_line);
} else if (parm_index && top == miny && bot == maxy) {
GoTo(NCURSES_SP_ARGx bot, 0);
UpdateAttrs(SP_PARM, blank);
GoTo(NCURSES_SP_ARGx bot, 0);
UpdateAttrs(SP_PARM, blank);
for (i = 0; i < n; i++) {
- TPUTS_TRACE("scroll_forward");
- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx scroll_forward);
+ NCURSES_PUTP2("scroll_forward", 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");
- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx delete_line);
+ NCURSES_PUTP2("delete_line", delete_line);
}
} else
return ERR;
if (n == 1 && scroll_reverse && top == miny && bot == maxy) {
GoTo(NCURSES_SP_ARGx top, 0);
UpdateAttrs(SP_PARM, blank);
- TPUTS_TRACE("scroll_reverse");
- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx scroll_reverse);
+ NCURSES_PUTP2("scroll_reverse", scroll_reverse);
} else if (n == 1 && insert_line && bot == maxy) {
GoTo(NCURSES_SP_ARGx top, 0);
UpdateAttrs(SP_PARM, blank);
- TPUTS_TRACE("insert_line");
- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx insert_line);
+ NCURSES_PUTP2("insert_line", insert_line);
} else if (parm_rindex && top == miny && bot == maxy) {
GoTo(NCURSES_SP_ARGx top, 0);
UpdateAttrs(SP_PARM, blank);
GoTo(NCURSES_SP_ARGx top, 0);
UpdateAttrs(SP_PARM, blank);
for (i = 0; i < n; i++) {
- TPUTS_TRACE("scroll_reverse");
- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx scroll_reverse);
+ NCURSES_PUTP2("scroll_reverse", 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");
- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx insert_line);
+ NCURSES_PUTP2("insert_line", insert_line);
}
} else
return ERR;
GoTo(NCURSES_SP_ARGx del, 0);
UpdateAttrs(SP_PARM, blank);
if (n == 1 && delete_line) {
- TPUTS_TRACE("delete_line");
- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx delete_line);
+ NCURSES_PUTP2("delete_line", delete_line);
} else if (parm_delete_line) {
TPUTS_TRACE("parm_delete_line");
NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
NCURSES_SP_NAME(_nc_outch));
} else { /* if (delete_line) */
for (i = 0; i < n; i++) {
- TPUTS_TRACE("delete_line");
- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx delete_line);
+ NCURSES_PUTP2("delete_line", delete_line);
}
}
GoTo(NCURSES_SP_ARGx ins, 0);
UpdateAttrs(SP_PARM, blank);
if (n == 1 && insert_line) {
- TPUTS_TRACE("insert_line");
- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx insert_line);
+ NCURSES_PUTP2("insert_line", insert_line);
} else if (parm_insert_line) {
TPUTS_TRACE("parm_insert_line");
NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
NCURSES_SP_NAME(_nc_outch));
} else { /* if (insert_line) */
for (i = 0; i < n; i++) {
- TPUTS_TRACE("insert_line");
- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx insert_line);
+ NCURSES_PUTP2("insert_line", insert_line);
}
}
&& (SP_PARM->_cursrow == bot || SP_PARM->_cursrow == bot - 1))
&& save_cursor && restore_cursor) {
cursor_saved = TRUE;
- TPUTS_TRACE("save_cursor");
- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx save_cursor);
+ NCURSES_PUTP2("save_cursor", save_cursor);
}
- TPUTS_TRACE("change_scroll_region");
- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx
- TPARM_2(change_scroll_region, top, bot));
+ NCURSES_PUTP2("change_scroll_region",
+ TPARM_2(change_scroll_region, top, bot));
if (cursor_saved) {
- TPUTS_TRACE("restore_cursor");
- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx restore_cursor);
+ NCURSES_PUTP2("restore_cursor", 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");
- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx
- TPARM_2(change_scroll_region, 0, maxy));
+ NCURSES_PUTP2("change_scroll_region",
+ TPARM_2(change_scroll_region, 0, maxy));
SP_PARM->_cursrow = SP_PARM->_curscol = -1;
}
SP_PARM->_cursrow == top - 1)
&& save_cursor && restore_cursor) {
cursor_saved = TRUE;
- TPUTS_TRACE("save_cursor");
- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx save_cursor);
+ NCURSES_PUTP2("save_cursor", save_cursor);
}
- TPUTS_TRACE("change_scroll_region");
- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx
- TPARM_2(change_scroll_region, top, bot));
+ NCURSES_PUTP2("change_scroll_region",
+ TPARM_2(change_scroll_region, top, bot));
if (cursor_saved) {
- TPUTS_TRACE("restore_cursor");
- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx restore_cursor);
+ NCURSES_PUTP2("restore_cursor", restore_cursor);
} else {
SP_PARM->_cursrow = SP_PARM->_curscol = -1;
}
res = scroll_csr_backward(NCURSES_SP_ARGx
-n, top, bot, top, bot, blank);
- TPUTS_TRACE("change_scroll_region");
- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx
- TPARM_2(change_scroll_region, 0, maxy));
+ NCURSES_PUTP2("change_scroll_region",
+ TPARM_2(change_scroll_region, 0, maxy));
SP_PARM->_cursrow = SP_PARM->_curscol = -1;
}
}
if (exit_attribute_mode)
- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx exit_attribute_mode);
+ NCURSES_PUTP2("exit_attribute_mode", exit_attribute_mode);
else {
/* turn off attributes */
if (exit_alt_charset_mode)
- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx exit_alt_charset_mode);
+ NCURSES_PUTP2("exit_alt_charset_mode", exit_alt_charset_mode);
if (exit_standout_mode)
- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx exit_standout_mode);
+ NCURSES_PUTP2("exit_standout_mode", exit_standout_mode);
if (exit_underline_mode)
- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx exit_underline_mode);
+ NCURSES_PUTP2("exit_underline_mode", exit_underline_mode);
}
if (exit_insert_mode)
- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx exit_insert_mode);
- if (enter_am_mode && exit_am_mode)
- NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx
- (auto_right_margin
- ? enter_am_mode
- : exit_am_mode));
+ NCURSES_PUTP2("exit_insert_mode", exit_insert_mode);
+ if (enter_am_mode && exit_am_mode) {
+ if (auto_right_margin) {
+ NCURSES_PUTP2("enter_am_mode", enter_am_mode);
+ } else {
+ NCURSES_PUTP2("exit_am_mode", exit_am_mode);
+ }
+ }
}
#if NCURSES_SP_FUNCS
/****************************************************************************
- * Copyright (c) 2002-2011,2012 Free Software Foundation, Inc. *
+ * Copyright (c) 2002-2012,2013 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 *
#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: lib_vid_attr.c,v 1.16 2012/06/09 20:29:33 tom Exp $")
+MODULE_ID("$Id: lib_vid_attr.c,v 1.17 2013/01/12 18:01:35 tom Exp $")
#define doPut(mode) TPUTS_TRACE(#mode); NCURSES_SP_NAME(tputs)(NCURSES_SP_ARGx mode, 1, outc)
newmode,
pair,
opts,
- NCURSES_SP_NAME(_nc_outch)));
+ NCURSES_SP_NAME(_nc_putchar)));
}
#if NCURSES_SP_FUNCS
-ncurses6 (5.9-20130105) unstable; urgency=low
+ncurses6 (5.9-20130112) unstable; urgency=low
* latest weekly patch
- -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 05 Jan 2013 10:15:33 -0500
+ -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 12 Jan 2013 10:00:42 -0500
ncurses6 (5.9-20120608) unstable; urgency=low
Summary: shared libraries for terminal handling
Name: ncurses6
Release: 5.9
-Version: 20130105
+Version: 20130112
License: X11
Group: Development/Libraries
Source: ncurses-%{release}-%{version}.tgz
/****************************************************************************
- * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2013 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 *
* results, use the ncurses(3) library. On non-Intel machines, SVr4 curses is
* just as good.
*
- * $Id: blue.c,v 1.33 2009/10/24 21:03:35 tom Exp $
+ * $Id: blue.c,v 1.34 2013/01/13 01:06:17 tom Exp $
*/
#include <test.priv.h>
if (value == NOCARD)
(void) addstr(" ");
else {
- addch(ranks[value % SUIT_LENGTH][0] | COLOR_PAIR(BLUE_ON_WHITE));
- addch(ranks[value % SUIT_LENGTH][1] | COLOR_PAIR(BLUE_ON_WHITE));
+ addch(ranks[value % SUIT_LENGTH][0] | (chtype) COLOR_PAIR(BLUE_ON_WHITE));
+ addch(ranks[value % SUIT_LENGTH][1] | (chtype) COLOR_PAIR(BLUE_ON_WHITE));
addch(suits[value / SUIT_LENGTH]);
}
(void) addch(' ');
/****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2010,2013 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 *
* authorization. *
****************************************************************************/
/*
- * $Id: firework.c,v 1.27 2010/11/13 20:58:25 tom Exp $
+ * $Id: firework.c,v 1.28 2013/01/13 01:06:17 tom Exp $
*/
#include <test.priv.h>
showit();
init_pair(1, get_colour(&bold), my_bg);
- (void) attrset(COLOR_PAIR(1) | bold);
+ (void) attrset((chtype) COLOR_PAIR(1) | bold);
MvPrintw(row - 1, col - 1, " - ");
MvPrintw(row + 0, col - 1, "-+-");
MvPrintw(row + 1, col - 1, " - ");
showit();
init_pair(1, get_colour(&bold), my_bg);
- (void) attrset(COLOR_PAIR(1) | bold);
+ (void) attrset((chtype) COLOR_PAIR(1) | bold);
MvPrintw(row - 2, col - 2, " --- ");
MvPrintw(row - 1, col - 2, "-+++-");
MvPrintw(row + 0, col - 2, "-+#+-");
showit();
init_pair(1, get_colour(&bold), my_bg);
- (void) attrset(COLOR_PAIR(1) | bold);
+ (void) attrset((chtype) COLOR_PAIR(1) | bold);
MvPrintw(row - 2, col - 2, " +++ ");
MvPrintw(row - 1, col - 2, "++#++");
MvPrintw(row + 0, col - 2, "+# #+");
showit();
init_pair(1, get_colour(&bold), my_bg);
- (void) attrset(COLOR_PAIR(1) | bold);
+ (void) attrset((chtype) COLOR_PAIR(1) | bold);
MvPrintw(row - 2, col - 2, " # ");
MvPrintw(row - 1, col - 2, "## ##");
MvPrintw(row + 0, col - 2, "# #");
showit();
init_pair(1, get_colour(&bold), my_bg);
- (void) attrset(COLOR_PAIR(1) | bold);
+ (void) attrset((chtype) COLOR_PAIR(1) | bold);
MvPrintw(row - 2, col - 2, " # # ");
MvPrintw(row - 1, col - 2, "# #");
MvPrintw(row + 0, col - 2, " ");
/****************************************************************************
- * Copyright (c) 1998-2008,2010 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2012,2013 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 *
* Eric S. Raymond <esr@snark.thyrsus.com> July 22 1995. Mouse support
* added September 20th 1995.
*
- * $Id: knight.c,v 1.33 2012/12/09 00:14:28 tom Exp $
+ * $Id: knight.c,v 1.34 2013/01/13 00:40:33 tom Exp $
*/
#include <test.priv.h>
(void) init_pair(PLUS_COLOR, (short) COLOR_RED, (short) bg);
(void) init_pair(MINUS_COLOR, (short) COLOR_GREEN, (short) bg);
- trail |= COLOR_PAIR(TRAIL_COLOR);
- plus |= COLOR_PAIR(PLUS_COLOR);
- minus |= COLOR_PAIR(MINUS_COLOR);
+ trail |= (chtype) COLOR_PAIR(TRAIL_COLOR);
+ plus |= (chtype) COLOR_PAIR(PLUS_COLOR);
+ minus |= (chtype) COLOR_PAIR(MINUS_COLOR);
}
#ifdef NCURSES_MOUSE_VERSION
(void) mousemask(BUTTON1_CLICKED, (mmask_t *) NULL);
-# $Id: modules,v 1.46 2012/12/02 00:50:53 tom Exp $
+# $Id: modules,v 1.47 2013/01/12 22:50:55 tom Exp $
##############################################################################
-# Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. #
+# Copyright (c) 1998-2012,2013 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 "Software"), #
test_instr progs $(srcdir) $(HEADER_DEPS)
test_inwstr progs $(srcdir) $(HEADER_DEPS)
test_opaque progs $(srcdir) $(HEADER_DEPS)
+test_vid_puts progs $(srcdir) $(HEADER_DEPS)
+test_vidputs progs $(srcdir) $(HEADER_DEPS)
testaddch progs $(srcdir) $(HEADER_DEPS)
testcurs progs $(srcdir) $(HEADER_DEPS)
testscanw progs $(srcdir) $(HEADER_DEPS)
/****************************************************************************
- * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2012,2013 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: Eric S. Raymond <esr@snark.thyrsus.com> 1993
Thomas E. Dickey (beginning revision 1.27 in 1996).
-$Id: ncurses.c,v 1.386 2012/12/29 23:37:55 tom Exp $
+$Id: ncurses.c,v 1.387 2013/01/13 00:40:17 tom Exp $
***************************************************************************/
/* Use non-default colors if possible to exercise bce a little */
if (use_colors) {
init_pair(1, COLOR_WHITE, COLOR_BLUE);
- normal |= COLOR_PAIR(1);
+ normal |= (chtype) COLOR_PAIR(1);
}
bkgdset(normal);
erase();
-# $Id: programs,v 1.19 2009/09/12 19:44:01 tom Exp $
+# $Id: programs,v 1.21 2013/01/13 00:46:13 tom Exp $
##############################################################################
-# Copyright (c) 2006-2008,2009 Free Software Foundation, Inc. #
+# Copyright (c) 2006-2009,2013 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 "Software"), #
test_instr $(LDFLAGS_CURSES) $(LOCAL_LIBS) test_instr
test_inwstr $(LDFLAGS_CURSES) $(LOCAL_LIBS) test_inwstr
test_opaque $(LDFLAGS_CURSES) $(LOCAL_LIBS) test_opaque
+test_vid_puts $(LDFLAGS_CURSES) $(LOCAL_LIBS) test_vid_puts
+test_vidputs $(LDFLAGS_CURSES) $(LOCAL_LIBS) test_vidputs
testaddch $(LDFLAGS_CURSES) $(LOCAL_LIBS) testaddch
testcurs $(LDFLAGS_CURSES) $(LOCAL_LIBS) testcurs
testscanw $(LDFLAGS_CURSES) $(LOCAL_LIBS) testscanw
--- /dev/null
+/****************************************************************************
+ * Copyright (c) 2013 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 *
+ * "Software"), to deal in the Software without restriction, including *
+ * without limitation the rights to use, copy, modify, merge, publish, *
+ * distribute, distribute with modifications, sublicense, and/or sell *
+ * copies of the Software, and to permit persons to whom the Software is *
+ * furnished to do so, subject to the following conditions: *
+ * *
+ * The above copyright notice and this permission notice shall be included *
+ * in all copies or substantial portions of the Software. *
+ * *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
+ * *
+ * Except as contained in this notice, the name(s) of the above copyright *
+ * holders shall not be used in advertising or otherwise to promote the *
+ * sale, use or other dealings in this Software without prior written *
+ * authorization. *
+ ****************************************************************************/
+/*
+ * $Id: test_vid_puts.c,v 1.4 2013/01/13 01:04:14 tom Exp $
+ *
+ * Demonstrate the vid_puts and vid_attr functions.
+ * Thomas Dickey - 2013/01/12
+ */
+
+#define USE_TINFO
+#include <test.priv.h>
+
+#if USE_WIDEC_SUPPORT && HAVE_SETUPTERM
+
+#define valid(s) ((s != 0) && s != (char *)-1)
+
+static FILE *my_fp;
+static bool p_opt = FALSE;
+
+static
+TPUTS_PROTO(outc, c)
+{
+ int rc = c;
+
+ rc = putc(c, my_fp);
+ TPUTS_RETURN(rc);
+}
+
+static bool
+outs(char *s)
+{
+ if (valid(s)) {
+ tputs(s, 1, outc);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+static void
+cleanup(void)
+{
+ outs(exit_attribute_mode);
+ if (!outs(orig_colors))
+ outs(orig_pair);
+ outs(cursor_normal);
+}
+
+static void
+change_attr(chtype attr)
+{
+ if (p_opt) {
+ vid_puts(attr, (short) 0, (void *) 0, outc);
+ } else {
+ vid_attr(attr, (short) 0, (void *) 0);
+ }
+}
+
+static void
+test_vid_puts(void)
+{
+ fprintf(my_fp, "Name: ");
+ change_attr(A_BOLD);
+ fputs("Bold", my_fp);
+ change_attr(A_REVERSE);
+ fputs(" Reverse", my_fp);
+ change_attr(A_NORMAL);
+ fputs("\n", my_fp);
+}
+
+static void
+usage(void)
+{
+ static const char *tbl[] =
+ {
+ "Usage: test_vid_puts [options]"
+ ,""
+ ,"Options:"
+ ," -e use stderr (default stdout)"
+ ," -p use vid_puts (default vid_attr)"
+ };
+ unsigned n;
+ for (n = 0; n < SIZEOF(tbl); ++n)
+ fprintf(stderr, "%s\n", tbl[n]);
+ ExitProgram(EXIT_FAILURE);
+}
+
+int
+main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
+{
+ int ch;
+
+ my_fp = stdout;
+
+ while ((ch = getopt(argc, argv, "ep")) != -1) {
+ switch (ch) {
+ case 'e':
+ my_fp = stderr;
+ break;
+ case 'p':
+ p_opt = TRUE;
+ break;
+ default:
+ usage();
+ break;
+ }
+ }
+ if (optind < argc)
+ usage();
+
+ setupterm((char *) 0, 1, (int *) 0);
+ test_vid_puts();
+ cleanup();
+ ExitProgram(EXIT_SUCCESS);
+}
+
+#else
+int
+main(void)
+{
+ printf("This program requires the wide-ncurses terminfo library\n");
+ ExitProgram(EXIT_FAILURE);
+}
+#endif
/****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 2013 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 *
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************/
-
/*
- * $Id: tty_input.h,v 1.2 2000/12/10 02:26:51 tom Exp $
+ * $Id: test_vidputs.c,v 1.3 2013/01/13 00:58:54 tom Exp $
+ *
+ * Demonstrate the vidputs and vidattr functions.
+ * Thomas Dickey - 2013/01/12
*/
-#ifndef TTY_INPUT_H
-#define TTY_INPUT_H 1
-
-extern NCURSES_EXPORT(bool) _nc_tty_mouse_mask (mmask_t);
-extern NCURSES_EXPORT(bool) _nc_tty_pending (void);
-extern NCURSES_EXPORT(int) _nc_tty_next_event (int);
-extern NCURSES_EXPORT(void) _nc_tty_flags_changed (void);
-extern NCURSES_EXPORT(void) _nc_tty_flush (void);
-extern NCURSES_EXPORT(void) _nc_tty_input_resume (void);
-extern NCURSES_EXPORT(void) _nc_tty_input_suspend (void);
-
-struct tty_input_data {
- int _ifd; /* input file ptr for screen */
- int _keypad_xmit; /* current terminal state */
- int _meta_on; /* current terminal state */
-
- /*
- * These are the data that support the mouse interface.
- */
- bool (*_mouse_event) (SCREEN *);
- bool (*_mouse_inline)(SCREEN *);
- bool (*_mouse_parse) (int);
- void (*_mouse_resume)(SCREEN *);
- void (*_mouse_wrap) (SCREEN *);
- int _mouse_fd; /* file-descriptor, if any */
- int mousetype;
-};
-
-#endif /* TTY_INPUT_H */
+#define USE_TINFO
+#include <test.priv.h>
+
+#if HAVE_SETUPTERM
+
+#define valid(s) ((s != 0) && s != (char *)-1)
+
+static FILE *my_fp;
+static bool p_opt = FALSE;
+
+static
+TPUTS_PROTO(outc, c)
+{
+ int rc = c;
+
+ rc = putc(c, my_fp);
+ TPUTS_RETURN(rc);
+}
+
+static bool
+outs(char *s)
+{
+ if (valid(s)) {
+ tputs(s, 1, outc);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+static void
+cleanup(void)
+{
+ outs(exit_attribute_mode);
+ if (!outs(orig_colors))
+ outs(orig_pair);
+ outs(cursor_normal);
+}
+
+static void
+change_attr(chtype attr)
+{
+ if (p_opt) {
+ vidputs(attr, outc);
+ } else {
+ vidattr(attr);
+ }
+}
+
+static void
+test_vidputs(void)
+{
+ fprintf(my_fp, "Name: ");
+ change_attr(A_BOLD);
+ fputs("Bold", my_fp);
+ change_attr(A_REVERSE);
+ fputs(" Reverse", my_fp);
+ change_attr(A_NORMAL);
+ fputs("\n", my_fp);
+}
+
+static void
+usage(void)
+{
+ static const char *tbl[] =
+ {
+ "Usage: test_vidputs [options]"
+ ,""
+ ,"Options:"
+ ," -e use stderr (default stdout)"
+ ," -p use vidputs (default vidattr)"
+ };
+ unsigned n;
+ for (n = 0; n < SIZEOF(tbl); ++n)
+ fprintf(stderr, "%s\n", tbl[n]);
+ ExitProgram(EXIT_FAILURE);
+}
+
+int
+main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
+{
+ int ch;
+
+ my_fp = stdout;
+
+ while ((ch = getopt(argc, argv, "ep")) != -1) {
+ switch (ch) {
+ case 'e':
+ my_fp = stderr;
+ break;
+ case 'p':
+ p_opt = TRUE;
+ break;
+ default:
+ usage();
+ break;
+ }
+ }
+ if (optind < argc)
+ usage();
+
+ setupterm((char *) 0, 1, (int *) 0);
+ test_vidputs();
+ cleanup();
+ ExitProgram(EXIT_SUCCESS);
+}
+#else
+int
+main(int argc GCC_UNUSED,
+ char *argv[]GCC_UNUSED)
+{
+ fprintf(stderr, "This program requires terminfo\n");
+ exit(EXIT_FAILURE);
+}
+#endif
/****************************************************************************
- * Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2011,2013 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 *
* This is an example written by Alexander V. Lukyanov <lav@yars.free.net>,
* to demonstrate an inconsistency between ncurses and SVr4 curses.
*
- * $Id: testaddch.c,v 1.8 2011/04/23 20:13:12 tom Exp $
+ * $Id: testaddch.c,v 1.9 2013/01/13 01:02:41 tom Exp $
*/
#include <test.priv.h>
}
addch('\n');
for (i = 0; i < 8; i++) {
- back = (i & 1) ? A_BOLD | 'B' | COLOR_PAIR(1) : ' ';
- set = (i & 2) ? A_REVERSE | COLOR_PAIR(2) : 0;
+ back = (i & 1) ? (A_BOLD | 'B' | COLOR_PAIR(1)) : ' ';
+ set = (i & 2) ? (A_REVERSE | COLOR_PAIR(2)) : 0;
attr = (chtype) ((i & 4) ? COLOR_PAIR(4) : 0);
bkgdset(back);
* scroll operation worked, and the refresh() code only had to do a
* partial repaint.
*
- * $Id: view.c,v 1.90 2013/01/05 23:18:13 tom Exp $
+ * $Id: view.c,v 1.91 2013/01/13 01:00:44 tom Exp $
*/
#include <test.priv.h>
case 'T':
{
char *next = 0;
- int tvalue = strtol(optarg, &next, 0);
+ int tvalue = (int) strtol(optarg, &next, 0);
if (tvalue < 0 || (next != 0 && *next != 0))
usage();
trace((unsigned) tvalue);
traces will be dumped. The program stops and waits for one character of
input at the beginning and end of the interval.
- $Id: worm.c,v 1.62 2012/12/15 18:32:40 tom Exp $
+ $Id: worm.c,v 1.63 2013/01/13 01:00:11 tom Exp $
*/
#include <test.priv.h>
#define SET_COLOR(num, fg) \
init_pair(num+1, (short) fg, (short) bg); \
- flavor[num] |= COLOR_PAIR(num+1) | A_BOLD
+ flavor[num] |= (chtype) COLOR_PAIR(num+1) | A_BOLD
SET_COLOR(0, COLOR_GREEN);
SET_COLOR(1, COLOR_RED);