From: Thomas E. Dickey Date: Sun, 13 Jan 2013 02:00:14 +0000 (+0000) Subject: ncurses 5.9 - patch 20130112 X-Git-Tag: v6.0~120 X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=commitdiff_plain;h=a1e63be290fce9e589bc57c9f753be09e8ac0cc7;ds=sidebyside ncurses 5.9 - patch 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). --- diff --git a/MANIFEST b/MANIFEST index 2bac9870..5216ad64 100644 --- a/MANIFEST +++ b/MANIFEST @@ -949,8 +949,6 @@ ./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 @@ -1107,6 +1105,8 @@ ./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 diff --git a/NEWS b/NEWS index f154f773..4988f4aa 100644 --- a/NEWS +++ b/NEWS @@ -25,7 +25,7 @@ -- 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 @@ -45,6 +45,17 @@ See the AUTHORS file for the corresponding full names. 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 diff --git a/dist.mk b/dist.mk index d59b7242..f475f108 100644 --- a/dist.mk +++ b/dist.mk @@ -25,7 +25,7 @@ # 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 @@ -37,7 +37,7 @@ SHELL = /bin/sh # 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) diff --git a/man/curs_terminfo.3x b/man/curs_terminfo.3x index 77a1b6bb..a9c6231b 100644 --- a/man/curs_terminfo.3x +++ b/man/curs_terminfo.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" 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 * @@ -26,7 +26,7 @@ .\" 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 @@ -77,7 +77,7 @@ .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 diff --git a/ncurses/base/lib_beep.c b/ncurses/base/lib_beep.c index 9d7f7fd9..4e14cb74 100644 --- a/ncurses/base/lib_beep.c +++ b/ncurses/base/lib_beep.c @@ -1,5 +1,5 @@ /**************************************************************************** - * 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 * @@ -46,7 +46,7 @@ #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() @@ -71,12 +71,9 @@ NCURSES_SP_NAME(beep) (NCURSES_SP_DCL0) 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 diff --git a/ncurses/base/lib_color.c b/ncurses/base/lib_color.c index 00392987..3339d56f 100644 --- a/ncurses/base/lib_color.c +++ b/ncurses/base/lib_color.c @@ -1,5 +1,5 @@ /**************************************************************************** - * 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 * @@ -45,7 +45,7 @@ #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 @@ -264,8 +264,7 @@ reset_color_pair(NCURSES_SP_DCL0) (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; @@ -292,8 +291,7 @@ NCURSES_SP_NAME(_nc_reset_colors) (NCURSES_SP_DCL0) 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 @@ -553,11 +551,11 @@ NCURSES_SP_NAME(init_pair) (NCURSES_SP_DCLx short pair, short f, short b) 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 @@ -615,8 +613,8 @@ NCURSES_SP_NAME(init_color) (NCURSES_SP_DCLx #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); diff --git a/ncurses/base/lib_flash.c b/ncurses/base/lib_flash.c index 2ef9c278..3520177e 100644 --- a/ncurses/base/lib_flash.c +++ b/ncurses/base/lib_flash.c @@ -1,5 +1,5 @@ /**************************************************************************** - * 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 * @@ -46,7 +46,7 @@ #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() @@ -69,13 +69,9 @@ NCURSES_SP_NAME(flash) (NCURSES_SP_DCL0) 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 diff --git a/ncurses/base/lib_mouse.c b/ncurses/base/lib_mouse.c index 6f621209..e84a964c 100644 --- a/ncurses/base/lib_mouse.c +++ b/ncurses/base/lib_mouse.c @@ -1,5 +1,5 @@ /**************************************************************************** - * 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 * @@ -84,7 +84,7 @@ #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 @@ -388,9 +388,7 @@ enable_xterm_mouse(SCREEN *sp, int enable) #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; } diff --git a/ncurses/base/lib_slkrefr.c b/ncurses/base/lib_slkrefr.c index 2cdc89cc..6d9fcd63 100644 --- a/ncurses/base/lib_slkrefr.c +++ b/ncurses/base/lib_slkrefr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * 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 * @@ -43,7 +43,7 @@ #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 @@ -100,8 +100,10 @@ slk_intern_refresh(SCREEN *sp) 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 { @@ -126,11 +128,9 @@ slk_intern_refresh(SCREEN *sp) 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 } diff --git a/ncurses/curses.priv.h b/ncurses/curses.priv.h index cebf4ad6..2a7b8b7a 100644 --- a/ncurses/curses.priv.h +++ b/ncurses/curses.priv.h @@ -1,5 +1,5 @@ /**************************************************************************** - * 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 * @@ -34,7 +34,7 @@ ****************************************************************************/ /* - * $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 * @@ -395,11 +395,7 @@ color_t; #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 */ @@ -412,14 +408,14 @@ color_t; 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) @@ -1242,7 +1238,7 @@ extern NCURSES_EXPORT_VAR(SIG_ATOMIC_T) _nc_have_sigwinch; 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 */ @@ -1377,7 +1373,7 @@ extern NCURSES_EXPORT_VAR(SIG_ATOMIC_T) _nc_have_sigwinch; #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; \ @@ -1389,12 +1385,12 @@ extern NCURSES_EXPORT_VAR(SIG_ATOMIC_T) _nc_have_sigwinch; (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]); \ } \ } \ } \ @@ -1441,7 +1437,7 @@ extern NCURSES_EXPORT_VAR(SIG_ATOMIC_T) _nc_have_sigwinch; #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) @@ -1866,6 +1862,8 @@ extern NCURSES_EXPORT(int) _nc_insert_ch(SCREEN *, WINDOW *, chtype); /* 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); @@ -1968,6 +1966,7 @@ extern NCURSES_EXPORT(int) _nc_getenv_num (const char *); 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); @@ -2278,7 +2277,7 @@ extern NCURSES_EXPORT(int) TINFO_MVCUR(SCREEN*, int, int, int, int); #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 /* @@ -2351,7 +2350,9 @@ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_curs_set)(SCREEN*,int); 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*); diff --git a/ncurses/tinfo/lib_acs.c b/ncurses/tinfo/lib_acs.c index d8fdedca..704eda5c 100644 --- a/ncurses/tinfo/lib_acs.c +++ b/ncurses/tinfo/lib_acs.c @@ -1,5 +1,5 @@ /**************************************************************************** - * 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 * @@ -39,7 +39,7 @@ #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 @@ -169,8 +169,7 @@ NCURSES_SP_NAME(_nc_init_acs) (NCURSES_SP_DCL0) 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 /* diff --git a/ncurses/tinfo/lib_options.c b/ncurses/tinfo/lib_options.c index e64b2758..613c5d04 100644 --- a/ncurses/tinfo/lib_options.c +++ b/ncurses/tinfo/lib_options.c @@ -1,5 +1,5 @@ /**************************************************************************** - * 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 * @@ -46,7 +46,7 @@ #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) @@ -165,16 +165,16 @@ meta(WINDOW *win GCC_UNUSED, 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; @@ -199,19 +199,16 @@ NCURSES_SP_NAME(curs_set) (NCURSES_SP_DCLx int vis) 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 @@ -301,7 +298,7 @@ NCURSES_EXPORT(int) 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(); } @@ -354,13 +351,9 @@ _nc_keypad(SCREEN *sp, int flag) 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) { diff --git a/ncurses/tinfo/lib_tputs.c b/ncurses/tinfo/lib_tputs.c index 586f2cd0..52367821 100644 --- a/ncurses/tinfo/lib_tputs.c +++ b/ncurses/tinfo/lib_tputs.c @@ -1,5 +1,5 @@ /**************************************************************************** - * 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 * @@ -51,7 +51,7 @@ #include /* ospeed */ #include -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 */ @@ -178,13 +178,48 @@ _nc_outch(int ch) } #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, @@ -194,18 +229,13 @@ NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_DCLx 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) { diff --git a/ncurses/tinfo/tinfo_driver.c b/ncurses/tinfo/tinfo_driver.c index 0a463082..7b6abc48 100644 --- a/ncurses/tinfo/tinfo_driver.c +++ b/ncurses/tinfo/tinfo_driver.c @@ -50,7 +50,7 @@ # 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, @@ -184,22 +184,18 @@ drv_dobeepflash(TERMINAL_CONTROL_BLOCK * TCB, int beepFlag) /* 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); } } @@ -315,7 +311,7 @@ drv_rescol(TERMINAL_CONTROL_BLOCK * TCB) 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; @@ -331,7 +327,7 @@ drv_rescolors(TERMINAL_CONTROL_BLOCK * TCB) 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; @@ -693,12 +689,11 @@ drv_initpair(TERMINAL_CONTROL_BLOCK * TCB, int pair, int f, int b) 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)); } } @@ -730,9 +725,8 @@ drv_initcolor(TERMINAL_CONTROL_BLOCK * TCB, 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)); } } @@ -896,7 +890,7 @@ drv_mvcur(TERMINAL_CONTROL_BLOCK * TCB, int yold, int xold, int ynew, int xnew) { 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 @@ -906,9 +900,8 @@ drv_hwlabel(TERMINAL_CONTROL_BLOCK * TCB, int labnum, char *text) 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)); } } @@ -919,9 +912,9 @@ drv_hwlabelOnOff(TERMINAL_CONTROL_BLOCK * TCB, int OnFlag) 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); } } @@ -986,7 +979,7 @@ drv_initacs(TERMINAL_CONTROL_BLOCK * TCB, chtype *real_map, chtype *fake_map) 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 /* @@ -1223,7 +1216,7 @@ __nc_putp(SCREEN *sp, const char *name GCC_UNUSED, const char *value) int rc = ERR; if (value) { - rc = NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx name, value); + rc = NCURSES_PUTP2(name, value); } return rc; } diff --git a/ncurses/tty/lib_mvcur.c b/ncurses/tty/lib_mvcur.c index 78453e35..634159dc 100644 --- a/ncurses/tty/lib_mvcur.c +++ b/ncurses/tty/lib_mvcur.c @@ -1,5 +1,5 @@ /**************************************************************************** - * 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 * @@ -159,7 +159,7 @@ #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 */ @@ -176,6 +176,9 @@ static bool profiling = FALSE; 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); @@ -274,10 +277,9 @@ reset_scroll_region(NCURSES_SP_DCL0) /* 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)); } } @@ -290,9 +292,7 @@ NCURSES_SP_NAME(_nc_mvcur_resume) (NCURSES_SP_DCL0) /* 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); } /* @@ -482,9 +482,7 @@ NCURSES_SP_NAME(_nc_mvcur_wrap) (NCURSES_SP_DCL0) } 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 @@ -944,9 +942,14 @@ onscreen_mvcur(NCURSES_SP_DCLx int yold, int xold, int ynew, int xnew, int ovw) 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; @@ -995,18 +998,14 @@ TINFO_MVCUR(NCURSES_SP_DCLx int yold, int xold, int ynew, int xnew) 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--; @@ -1043,13 +1042,63 @@ TINFO_MVCUR(NCURSES_SP_DCLx int yold, int xold, int ynew, int xnew) 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; diff --git a/ncurses/tty/lib_vidattr.c b/ncurses/tty/lib_vidattr.c index 4e2184bc..c0a406c5 100644 --- a/ncurses/tty/lib_vidattr.c +++ b/ncurses/tty/lib_vidattr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * 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 * @@ -69,7 +69,7 @@ #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); \ @@ -324,7 +324,7 @@ NCURSES_SP_NAME(vidattr) (NCURSES_SP_DCLx chtype newmode) 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 diff --git a/ncurses/tty/tty_display.h b/ncurses/tty/tty_display.h deleted file mode 100644 index 4c45a084..00000000 --- a/ncurses/tty/tty_display.h +++ /dev/null @@ -1,140 +0,0 @@ -/**************************************************************************** - * 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 */ diff --git a/ncurses/tty/tty_update.c b/ncurses/tty/tty_update.c index 01feddd9..e9ad6981 100644 --- a/ncurses/tty/tty_update.c +++ b/ncurses/tty/tty_update.c @@ -1,5 +1,5 @@ /**************************************************************************** - * 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 * @@ -82,7 +82,7 @@ #include -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 @@ -145,8 +145,7 @@ position_check(NCURSES_SP_DCLx int expected_y, int expected_x, char *legend) 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); @@ -316,8 +315,7 @@ PutAttrChar(NCURSES_SP_DCLx CARG_CH_T ch) #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); } } @@ -388,8 +386,7 @@ PutCharLR(NCURSES_SP_DCLx const ARG_CH_T ch) 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--; @@ -398,8 +395,7 @@ PutCharLR(NCURSES_SP_DCLx const ARG_CH_T ch) 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 @@ -561,8 +557,7 @@ EmitRange(NCURSES_SP_DCLx const NCURSES_CH_T * ntext, int num) && 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, @@ -1098,9 +1093,8 @@ ClrToEOL(NCURSES_SP_DCLx NCURSES_CH_T blank, int needclear) 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) @@ -1366,13 +1360,11 @@ TransformLine(NCURSES_SP_DCLx int const lineno) && 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) @@ -1570,8 +1562,7 @@ ClearScreen(NCURSES_SP_DCLx NCURSES_CH_T blank) 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, @@ -1591,8 +1582,7 @@ ClearScreen(NCURSES_SP_DCLx NCURSES_CH_T blank) 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); } @@ -1643,27 +1633,22 @@ InsStr(NCURSES_SP_DCLx NCURSES_CH_T * line, int count) 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--; @@ -1697,8 +1682,7 @@ DelChar(NCURSES_SP_DCLx int 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); } } } @@ -1750,13 +1734,11 @@ scroll_csr_forward(NCURSES_SP_DCLx 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); @@ -1777,15 +1759,13 @@ scroll_csr_forward(NCURSES_SP_DCLx 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; @@ -1819,13 +1799,11 @@ scroll_csr_backward(NCURSES_SP_DCLx 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); @@ -1846,15 +1824,13 @@ scroll_csr_backward(NCURSES_SP_DCLx 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; @@ -1885,8 +1861,7 @@ scroll_idl(NCURSES_SP_DCLx int n, int del, int ins, NCURSES_CH_T blank) 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 @@ -1895,16 +1870,14 @@ scroll_idl(NCURSES_SP_DCLx int n, int del, int ins, NCURSES_CH_T blank) 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 @@ -1913,8 +1886,7 @@ scroll_idl(NCURSES_SP_DCLx int n, int del, int ins, NCURSES_CH_T blank) 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); } } @@ -1971,24 +1943,20 @@ NCURSES_SP_NAME(_nc_scrolln) (NCURSES_SP_DCLx && (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; } @@ -2021,15 +1989,12 @@ NCURSES_SP_NAME(_nc_scrolln) (NCURSES_SP_DCLx 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; } @@ -2037,9 +2002,8 @@ NCURSES_SP_NAME(_nc_scrolln) (NCURSES_SP_DCLx 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; } @@ -2110,23 +2074,25 @@ NCURSES_SP_NAME(_nc_screen_resume) (NCURSES_SP_DCL0) } 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 diff --git a/ncurses/widechar/lib_vid_attr.c b/ncurses/widechar/lib_vid_attr.c index 9fc802d7..c752c1d1 100644 --- a/ncurses/widechar/lib_vid_attr.c +++ b/ncurses/widechar/lib_vid_attr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * 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 * @@ -36,7 +36,7 @@ #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) @@ -278,7 +278,7 @@ NCURSES_SP_NAME(vid_attr) (NCURSES_SP_DCLx newmode, pair, opts, - NCURSES_SP_NAME(_nc_outch))); + NCURSES_SP_NAME(_nc_putchar))); } #if NCURSES_SP_FUNCS diff --git a/package/debian/changelog b/package/debian/changelog index 6d8b7350..54a7f92b 100644 --- a/package/debian/changelog +++ b/package/debian/changelog @@ -1,8 +1,8 @@ -ncurses6 (5.9-20130105) unstable; urgency=low +ncurses6 (5.9-20130112) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sat, 05 Jan 2013 10:15:33 -0500 + -- Thomas E. Dickey Sat, 12 Jan 2013 10:00:42 -0500 ncurses6 (5.9-20120608) unstable; urgency=low diff --git a/package/ncurses.spec b/package/ncurses.spec index 9f472cfa..e210d01f 100644 --- a/package/ncurses.spec +++ b/package/ncurses.spec @@ -1,7 +1,7 @@ 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 diff --git a/test/blue.c b/test/blue.c index dfe6abf1..dcea1383 100644 --- a/test/blue.c +++ b/test/blue.c @@ -1,5 +1,5 @@ /**************************************************************************** - * 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 * @@ -40,7 +40,7 @@ * 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 @@ -202,8 +202,8 @@ printcard(int value) 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(' '); diff --git a/test/firework.c b/test/firework.c index 2c409d83..4da069b4 100644 --- a/test/firework.c +++ b/test/firework.c @@ -1,5 +1,5 @@ /**************************************************************************** - * 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 * @@ -26,7 +26,7 @@ * 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 @@ -94,14 +94,14 @@ explode(int row, int col) 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, "-+#+-"); @@ -110,7 +110,7 @@ explode(int row, int col) 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, "+# #+"); @@ -119,7 +119,7 @@ explode(int row, int col) 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, "# #"); @@ -128,7 +128,7 @@ explode(int row, int col) 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, " "); diff --git a/test/knight.c b/test/knight.c index 604be1ec..91c1ba36 100644 --- a/test/knight.c +++ b/test/knight.c @@ -1,5 +1,5 @@ /**************************************************************************** - * 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 * @@ -33,7 +33,7 @@ * Eric S. Raymond 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 @@ -123,9 +123,9 @@ init_program(void) (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); diff --git a/test/modules b/test/modules index d9a40905..997b5760 100644 --- a/test/modules +++ b/test/modules @@ -1,6 +1,6 @@ -# $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"), # @@ -86,6 +86,8 @@ test_getstr progs $(srcdir) $(HEADER_DEPS) 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) diff --git a/test/ncurses.c b/test/ncurses.c index 15f73296..b18205dc 100644 --- a/test/ncurses.c +++ b/test/ncurses.c @@ -1,5 +1,5 @@ /**************************************************************************** - * 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 * @@ -40,7 +40,7 @@ AUTHOR Author: Eric S. Raymond 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 $ ***************************************************************************/ @@ -3908,7 +3908,7 @@ test_sgr_attributes(void) /* 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(); diff --git a/test/programs b/test/programs index bfcc134e..47708916 100644 --- a/test/programs +++ b/test/programs @@ -1,6 +1,6 @@ -# $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"), # @@ -83,6 +83,8 @@ test_getstr $(LDFLAGS_CURSES) $(LOCAL_LIBS) test_getstr 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 diff --git a/test/test_vid_puts.c b/test/test_vid_puts.c new file mode 100644 index 00000000..3a2bc82f --- /dev/null +++ b/test/test_vid_puts.c @@ -0,0 +1,148 @@ +/**************************************************************************** + * 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 + +#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 diff --git a/ncurses/tty/tty_input.h b/test/test_vidputs.c similarity index 51% rename from ncurses/tty/tty_input.h rename to test/test_vidputs.c index e520793e..c32f50b7 100644 --- a/ncurses/tty/tty_input.h +++ b/test/test_vidputs.c @@ -1,5 +1,5 @@ /**************************************************************************** - * 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 * @@ -25,37 +25,124 @@ * 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 + +#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 diff --git a/test/testaddch.c b/test/testaddch.c index d0c36d43..f0a476e1 100644 --- a/test/testaddch.c +++ b/test/testaddch.c @@ -1,5 +1,5 @@ /**************************************************************************** - * 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 * @@ -29,7 +29,7 @@ * This is an example written by Alexander V. Lukyanov , * 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 @@ -72,8 +72,8 @@ main( } 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); diff --git a/test/view.c b/test/view.c index cf11cbf0..f775040a 100644 --- a/test/view.c +++ b/test/view.c @@ -50,7 +50,7 @@ * 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 @@ -274,7 +274,7 @@ main(int argc, char *argv[]) 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); diff --git a/test/worm.c b/test/worm.c index f64911c6..0d220991 100644 --- a/test/worm.c +++ b/test/worm.c @@ -61,7 +61,7 @@ Options: 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 @@ -502,7 +502,7 @@ main(int argc, char *argv[]) #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);