From: Thomas E. Dickey Date: Sun, 3 May 2009 00:59:25 +0000 (+0000) Subject: ncurses 5.7 - patch 20090425 X-Git-Tag: v5.8~93 X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=commitdiff_plain;h=d998cb49bfb53bd99900fd4ed94519579bea99de ncurses 5.7 - patch 20090425 --- diff --git a/NEWS b/NEWS index b5c9782a..bedbaae8 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.1383 2009/04/25 21:28:43 tom Exp $ +-- $Id: NEWS,v 1.1384 2009/05/02 22:27:02 tom Exp $ ------------------------------------------------------------------------------- This is a log of changes that ncurses has gone through since Zeyd started @@ -45,6 +45,10 @@ 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. +20090502 + + continue integrating "sp-funcs" by Juergen Pfeifer (incomplete). + + add vwmterm terminfo entry (patch by Bryan Christ). + 20090425 + continue integrating "sp-funcs" by Juergen Pfeifer (incomplete). diff --git a/c++/demo.cc b/c++/demo.cc index ddd5f2b3..35433425 100644 --- a/c++/demo.cc +++ b/c++/demo.cc @@ -35,7 +35,7 @@ * Demo code for NCursesMenu and NCursesForm written by * Juergen Pfeifer * - * $Id: demo.cc,v 1.38 2008/08/04 17:16:57 tom Exp $ + * $Id: demo.cc,v 1.39 2008/12/07 02:07:34 juergen Exp $ */ #include "internal.h" @@ -43,7 +43,13 @@ #include "cursesm.h" #include "cursesf.h" +#ifdef __MINGW32__ +#undef KEY_EVENT +#endif + +#ifndef __MINGW32__ extern "C" unsigned int sleep(unsigned int); +#endif #undef index // needed for NeXT diff --git a/c++/internal.h b/c++/internal.h index 3066e72f..64d57cd7 100644 --- a/c++/internal.h +++ b/c++/internal.h @@ -31,7 +31,7 @@ * Author: Juergen Pfeifer, 1997 * ****************************************************************************/ -// $Id: internal.h,v 1.16 2008/10/25 21:35:44 tom Exp $ +// $Id: internal.h,v 1.17 2008/12/07 02:07:34 juergen Exp $ #ifndef NCURSES_CPLUS_INTERNAL_H #define NCURSES_CPLUS_INTERNAL_H 1 @@ -44,6 +44,11 @@ #define MODULE_ID(id) /*nothing*/ #endif +#ifdef __MINGW32__ +#include +#undef KEY_EVENT +#endif + #ifndef _QNX_SOURCE #include #include diff --git a/dist.mk b/dist.mk index 99811e41..c7d22744 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.696 2009/04/25 17:43:20 tom Exp $ +# $Id: dist.mk,v 1.697 2009/05/02 17:26:04 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 = 7 -NCURSES_PATCH = 20090425 +NCURSES_PATCH = 20090502 # We don't append the patch to the version, since this only applies to releases VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR) diff --git a/include/MKterm.h.awk.in b/include/MKterm.h.awk.in index 9f635d65..4e33af26 100644 --- a/include/MKterm.h.awk.in +++ b/include/MKterm.h.awk.in @@ -34,7 +34,7 @@ BEGIN { print "/* and: Thomas E. Dickey 1995-on */" print "/****************************************************************************/" print "" - print "/* $Id: MKterm.h.awk.in,v 1.55 2009/04/25 18:02:27 tom Exp $ */" + print "/* $Id: MKterm.h.awk.in,v 1.56 2009/05/02 19:25:57 tom Exp $ */" print "" print "/*" print "** term.h -- Definition of struct term" @@ -348,6 +348,8 @@ END { print "" print "extern NCURSES_EXPORT(TERMINAL *) NCURSES_SP_NAME(set_curterm) (SCREEN*, TERMINAL *);" print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(del_curterm) (SCREEN*, TERMINAL *);" + print "" + print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(restartterm) (SCREEN*, NCURSES_CONST char *, int, int *);" print "#endif /* NCURSES_SP_FUNCS */" print "" print "#ifdef __cplusplus" diff --git a/include/curses.h.in b/include/curses.h.in index 7adcb622..4c886142 100644 --- a/include/curses.h.in +++ b/include/curses.h.in @@ -32,7 +32,7 @@ * and: Thomas E. Dickey 1996-on * ****************************************************************************/ -/* $Id: curses.h.in,v 1.197 2009/04/25 21:03:34 tom Exp $ */ +/* $Id: curses.h.in,v 1.198 2009/05/02 21:59:55 tom Exp $ */ #ifndef __NCURSES_H #define __NCURSES_H @@ -960,6 +960,8 @@ extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(termname) (SCREEN*); /* implemente extern NCURSES_EXPORT(int) NCURSES_SP_NAME(typeahead) (SCREEN*, int); /* implemented */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(ungetch) (SCREEN*, int); /* implemented */ extern NCURSES_EXPORT(void) NCURSES_SP_NAME(use_env) (SCREEN*, bool); /* implemented */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vidattr) (SCREEN*, chtype); /* implemented */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vidputs) (SCREEN*, chtype, int (*)(int)); /* implemented */ #if @NCURSES_EXT_FUNCS@ extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(keybound) (SCREEN*, int, int); extern NCURSES_EXPORT(int) NCURSES_SP_NAME(assume_default_colors) (SCREEN*, int, int); diff --git a/include/curses.wide b/include/curses.wide index 520875e7..6ba9280f 100644 --- a/include/curses.wide +++ b/include/curses.wide @@ -1,4 +1,4 @@ -/* $Id: curses.wide,v 1.37 2009/04/18 21:34:06 tom Exp $ */ +/* $Id: curses.wide,v 1.38 2009/05/02 23:12:00 tom Exp $ */ /* * vile:cmode: * This file is part of ncurses, designed to be appended after curses.h.in @@ -171,6 +171,8 @@ extern NCURSES_EXPORT(int) wvline_set (WINDOW *, const cchar_t *, int); /* imple extern NCURSES_EXPORT(attr_t) NCURSES_SP_NAME(term_attrs) (SCREEN*); /* implemented */ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(unget_wch) (SCREEN*, const wchar_t); /* implemented */ extern NCURSES_EXPORT(wchar_t*) NCURSES_SP_NAME(wunctrl) (SCREEN*, cchar_t *); /* implemented */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vid_attr) (SCREEN*, attr_t, short, void *); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vid_puts) (SCREEN*, attr_t, short, void *, int (*)(int)); #endif #ifndef NCURSES_NOMACROS diff --git a/include/ncurses_defs b/include/ncurses_defs index 97a377dc..b07f5f1f 100644 --- a/include/ncurses_defs +++ b/include/ncurses_defs @@ -1,4 +1,4 @@ -# $Id: ncurses_defs,v 1.40 2008/09/06 15:57:41 tom Exp $ +# $Id: ncurses_defs,v 1.41 2008/11/16 00:19:59 juergen Exp $ ############################################################################## # Copyright (c) 2000-2007,2008 Free Software Foundation, Inc. # # # @@ -171,7 +171,6 @@ NCURSES_EXT_COLORS NCURSES_EXT_FUNCS NCURSES_NO_PADDING NCURSES_PATHSEP ':' -NDEBUG NEED_PTEM_H NO_LEAKS PURE_TERMINFO diff --git a/misc/terminfo.src b/misc/terminfo.src index 96ce6e0f..cf71f91b 100644 --- a/misc/terminfo.src +++ b/misc/terminfo.src @@ -6,8 +6,8 @@ # Report bugs and new terminal descriptions to # bug-ncurses@gnu.org # -# $Revision: 1.347 $ -# $Date: 2009/03/28 23:19:33 $ +# $Revision: 1.348 $ +# $Date: 2009/05/02 22:23:20 $ # # The original header is preserved below for reference. It is noted that there # is a "newer" version which differs in some cosmetic details (but actually @@ -4319,6 +4319,30 @@ decansi|ANSI emulation with DEC compatibility hacks, smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, u6=\E[%i%d;%dR, u7=\E[6n, vpa=\E[%i%p1%dd, +#### VWM +# +# vwmterm is a terminal emulator written for the VWM console window manager +# +vwmterm|(vwm term), + am, bce, ccc, mir, msgr, npc, xenl, xon, + colors#8, pairs#64, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, + clear=\E[H\E[J, cnorm=\E[?25h, cr=^M, cub1=^H, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cvvis=\E[?25h, dim=\E[2m, ed=\E[J, el=\E[K, home=\E[H, + il1=\E[L, ind=^J, invis=\E[8m, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, kend=\E[4~, kf1=\E[[A, + kf10=\E[21~, kf11=\E[22~, kf12=\E[23~, kf2=\E[[B, + kf3=\E[[C, kf4=\E[[D, kf5=\E[[E, kf6=\E[17~, kf7=\E[18~, + kf8=\E[19~, kf9=\E[20~, khome=\E[1~, knp=\E[6~, kpp=\E[5~, + rev=\E[7m, rmacs=\E[10m, rmam=\E[?7l, rmcup=\E[?1049l, + rs1=\E[H\E[J\E[m\Ec, setab=\E[4%p1%dm, + setaf=\E[3%p1%dm, + sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;11%;m, + sgr0=\E[0;10m, smacs=\E[11m, smam=\E[?7h, + smcup=\E[?1049h, smso=\E[3m, smul=\E[4m, + #### MGR # # MGR is a Bell Labs window system lighter-weight than X. @@ -21832,6 +21856,9 @@ v3220|LANPAR Vision II model 3220/3221/3222, # * move function- and cursor-keys from emx-base to ansi.sys, and create # a pfkey capability which handles F1-F48 -TD # +# 2009-05-02 +# * add vwmterm entry (Bryan Christ) +# # The following sets edit modes for GNU EMACS. # Local Variables: # fill-prefix:"\t" diff --git a/ncurses/base/lib_restart.c b/ncurses/base/lib_restart.c index da770d4e..55b1cc09 100644 --- a/ncurses/base/lib_restart.c +++ b/ncurses/base/lib_restart.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. * + * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -30,6 +30,7 @@ * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * * and: Thomas E. Dickey 1996-on * + * and: Juergen Pfeifer 2008 * ****************************************************************************/ /* @@ -44,49 +45,52 @@ #define _POSIX_SOURCE #endif -#include /* lines, columns, cur_term */ - -MODULE_ID("$Id: lib_restart.c,v 1.10 2008/06/21 17:31:22 tom Exp $") +MODULE_ID("$Id: lib_restart.c,v 1.11 2009/05/02 20:47:42 tom Exp $") NCURSES_EXPORT(int) -restartterm(NCURSES_CONST char *termp, int filenum, int *errret) +NCURSES_SP_NAME(restartterm) (NCURSES_SP_DCLx + NCURSES_CONST char *termp, + int filenum, + int *errret) { int result; - T((T_CALLED("restartterm(%s,%d,%p)"), termp, filenum, errret)); + T((T_CALLED("restartterm(%p,%s,%d,%p)"), SP_PARM, termp, filenum, errret)); if (setupterm(termp, filenum, errret) != OK) { result = ERR; - } else if (SP != 0) { - int saveecho = SP->_echo; - int savecbreak = SP->_cbreak; - int saveraw = SP->_raw; - int savenl = SP->_nl; + } else if (SP_PARM != 0) { + int saveecho = SP_PARM->_echo; + int savecbreak = SP_PARM->_cbreak; + int saveraw = SP_PARM->_raw; + int savenl = SP_PARM->_nl; - if (saveecho) - echo(); - else - noecho(); + if (saveecho) { + NCURSES_SP_NAME(echo) (NCURSES_SP_ARG); + } else { + NCURSES_SP_NAME(noecho) (NCURSES_SP_ARG); + } if (savecbreak) { - cbreak(); - noraw(); + NCURSES_SP_NAME(cbreak) (NCURSES_SP_ARG); + NCURSES_SP_NAME(noraw) (NCURSES_SP_ARG); } else if (saveraw) { - nocbreak(); - raw(); + NCURSES_SP_NAME(nocbreak) (NCURSES_SP_ARG); + NCURSES_SP_NAME(raw) (NCURSES_SP_ARG); + } else { + NCURSES_SP_NAME(nocbreak) (NCURSES_SP_ARG); + NCURSES_SP_NAME(noraw) (NCURSES_SP_ARG); + } + if (savenl) { + NCURSES_SP_NAME(nl) (NCURSES_SP_ARG); } else { - nocbreak(); - noraw(); + NCURSES_SP_NAME(nonl) (NCURSES_SP_ARG); } - if (savenl) - nl(); - else - nonl(); - reset_prog_mode(); + NCURSES_SP_NAME(reset_prog_mode) (NCURSES_SP_ARG); #if USE_SIZECHANGE - _nc_update_screensize(SP); + _nc_update_screensize(SP_PARM); #endif result = OK; @@ -95,3 +99,11 @@ restartterm(NCURSES_CONST char *termp, int filenum, int *errret) } returnCode(result); } + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +restartterm(NCURSES_CONST char *termp, int filenum, int *errret) +{ + return NCURSES_SP_NAME(restartterm) (CURRENT_SCREEN, termp, filenum, errret); +} +#endif diff --git a/ncurses/curses.priv.h b/ncurses/curses.priv.h index acc94be2..04f7c914 100644 --- a/ncurses/curses.priv.h +++ b/ncurses/curses.priv.h @@ -35,7 +35,7 @@ /* - * $Id: curses.priv.h,v 1.410 2009/04/25 23:38:37 tom Exp $ + * $Id: curses.priv.h,v 1.412 2009/05/02 21:28:57 tom Exp $ * * curses.priv.h * @@ -303,8 +303,14 @@ color_t; #define GET_WINDOW_PAIR(w) (w)->_color #define SET_WINDOW_PAIR(w,p) (w)->_color = (p) #define SameAttrOf(a,b) (AttrOf(a) == AttrOf(b) && GetPair(a) == GetPair(b)) -#define VIDATTR(attr, pair) vid_attr(attr, pair, 0) + +#if NCURSES_SP_FUNCS +#define VIDATTR(sp,attr,pair) NCURSES_SP_NAME(vid_attr)(sp, attr, pair, 0) #else +#define VIDATTR(sp,attr,pair) vid_attr(attr, pair, 0) +#endif + +#else /* !(NCURSES_EXT_COLORS && USE_WIDEC_SUPPORT) */ #define if_EXT_COLORS(stmt) /* nothing */ #define SetPair(value,p) RemAttr(value, A_COLOR), \ SetAttr(value, AttrOf(value) | (A_COLOR & COLOR_PAIR(p))) @@ -314,9 +320,15 @@ color_t; #define SET_WINDOW_PAIR(w,p) WINDOW_ATTRS(w) &= ALL_BUT_COLOR, \ WINDOW_ATTRS(w) |= (A_COLOR & COLOR_PAIR(p)) #define SameAttrOf(a,b) (AttrOf(a) == AttrOf(b)) -#define VIDATTR(attr, pair) vidattr(attr) + +#if NCURSES_SP_FUNCS +#define VIDATTR(sp,attr,pair) NCURSES_SP_NAME(vidattr)(sp, attr) +#else +#define VIDATTR(sp,attr,pair) vidattr(attr) #endif +#endif /* NCURSES_EXT_COLORS && USE_WIDEC_SUPPORT */ + #if NCURSES_NO_PADDING #define GetNoPadding(sp) ((sp) ? (sp)->_no_padding : _nc_prescreen._no_padding) #define SetNoPadding(sp) _nc_set_no_padding(sp) @@ -1399,7 +1411,7 @@ extern NCURSES_EXPORT(void) name (void); \ #define ALL_BUT_COLOR ((chtype)~(A_COLOR)) #define NONBLANK_ATTR (A_NORMAL|A_BOLD|A_DIM|A_BLINK) -#define XMC_CHANGES(c) ((c) & SP->_xmc_suppress) +#define XMC_CHANGES(c) ((c) & SP_PARM->_xmc_suppress) #define toggle_attr_on(S,at) {\ if (PAIR_NUMBER(at) > 0) {\ @@ -1437,7 +1449,7 @@ extern NCURSES_EXPORT(void) name (void); \ #if USE_XMC_SUPPORT #define UpdateAttrs(sp,c) if (!SameAttrOf(SCREEN_ATTRS(sp), c)) { \ attr_t chg = AttrOf(SCREEN_ATTRS(sp)); \ - VIDATTR(AttrOf(c), GetPair(c)); \ + VIDATTR(sp, AttrOf(c), GetPair(c)); \ if (magic_cookie_glitch > 0 \ && XMC_CHANGES((chg ^ AttrOf(SCREEN_ATTRS(sp))))) { \ T(("%s @%d before glitch %d,%d", \ @@ -1449,7 +1461,7 @@ extern NCURSES_EXPORT(void) name (void); \ } #else #define UpdateAttrs(sp,c) if (!SameAttrOf(SCREEN_ATTRS(sp), c)) \ - VIDATTR(AttrOf(c), GetPair(c)); + VIDATTR(sp, AttrOf(c), GetPair(c)); #endif /* @@ -1578,10 +1590,10 @@ extern NCURSES_EXPORT(bool) _nc_has_mouse (SCREEN *); /* lib_setup.c */ extern NCURSES_EXPORT(char *) _nc_get_locale(void); -extern NCURSES_EXPORT(int) _nc_unicode_locale(void); -extern NCURSES_EXPORT(int) _nc_locale_breaks_acs(TERMINAL *); -extern NCURSES_EXPORT(int) _nc_setupterm(NCURSES_CONST char *, int, int *, bool); -extern NCURSES_EXPORT(void) _nc_get_screensize(SCREEN *, int *, int *); +extern NCURSES_EXPORT(int) _nc_unicode_locale(void); +extern NCURSES_EXPORT(int) _nc_locale_breaks_acs(TERMINAL *); +extern NCURSES_EXPORT(int) _nc_setupterm(NCURSES_CONST char *, int, int *, bool); +extern NCURSES_EXPORT(void) _nc_get_screensize(SCREEN *, int *, int *); /* lib_tstp.c */ #if USE_SIGWINCH @@ -1646,7 +1658,7 @@ extern NCURSES_EXPORT(int) _nc_setupscreen (int, int, FILE *, bool, int); extern NCURSES_EXPORT(int) _nc_timed_wait (SCREEN *, int, int, int * EVENTLIST_2nd(_nc_eventlist *)); extern NCURSES_EXPORT(void) _nc_do_color (short, short, bool, int (*)(int)); extern NCURSES_EXPORT(void) _nc_flush (void); -extern NCURSES_EXPORT(void) _nc_free_and_exit (int); +extern NCURSES_EXPORT(void) _nc_free_and_exit (int) GCC_NORETURN; extern NCURSES_EXPORT(void) _nc_free_entry (ENTRY *, TERMTYPE *); extern NCURSES_EXPORT(void) _nc_freeall (void); extern NCURSES_EXPORT(void) _nc_hash_map (void); @@ -1712,7 +1724,7 @@ extern NCURSES_EXPORT_VAR(int *) _nc_oldnums; #define NC_BUFFERED(flag) _nc_set_buffer(SP->_ofp, flag) -#define NC_OUTPUT ((SP_PARM != 0) ? SP_PARM->_ofp : stdout) +#define NC_OUTPUT(sp) ((sp != 0) ? sp->_ofp : stdout) /* * On systems with a broken linker, define 'SP' as a function to force the @@ -1775,6 +1787,112 @@ extern NCURSES_EXPORT(int) _nc_ripoffline (int line, int (*init)(WINDOW *,int)); #define TW_ANY (TW_INPUT | TW_MOUSE) #define TW_EVENT 4 +#define SetSafeOutcWrapper(outc) \ + SCREEN* sp = CURRENT_SCREEN; \ + if (sp==0) { \ + struct screen dummy; \ + sp = &dummy; \ + memset(sp,0,sizeof(struct screen)); \ + sp->_outch = _nc_outc_wrapper; \ + }\ + sp->jump = outc + +struct DriverTCB; /* Terminal Control Block forward declaration */ +typedef void* TERM_HANDLE; + +typedef struct _termInfo +{ + bool caninit; + + bool hascolor; + bool initcolor; + bool canchange; + + int tabsize; + + int maxcolors; + int maxpairs; + int nocolorvideo; + + int numlabels; + int labelwidth; + int labelheight; + + const color_t* defaultPalette; +} TerminalInfo; + +typedef struct term_driver { + bool isTerminfo; + bool (*CanHandle)(struct DriverTCB*,const char*,int*); + void (*init)(struct DriverTCB*); + void (*release)(struct DriverTCB*); + int (*size)(struct DriverTCB*, int* Line, int *Cols); + int (*sgmode)(struct DriverTCB*, bool setFlag, TTY*); + chtype (*conattr)(struct DriverTCB*); + int (*hwcur)(struct DriverTCB*, int yold, int xold, int y, int x); + int (*mode)(struct DriverTCB*, bool progFlag, bool defFlag); + bool (*rescol)(struct DriverTCB*); + bool (*rescolors)(struct DriverTCB*); + void (*color)(struct DriverTCB*,bool fore, int color, int(*)(SCREEN*,int)); + int (*doBeepOrFlash)(struct DriverTCB*, bool); + void (*initpair)(struct DriverTCB*,short,short,short); + void (*initcolor)(struct DriverTCB*,short,short,short,short); + void (*docolor)(struct DriverTCB*,short,short,bool,int(*)(SCREEN*,int)); + void (*initmouse)(struct DriverTCB*); + void (*setfilter)(struct DriverTCB*); + void (*hwlabel)(struct DriverTCB*,int,char*); + void (*hwlabelOnOff)(struct DriverTCB*,bool); + int (*update)(struct DriverTCB*); + int (*defaultcolors)(struct DriverTCB*,int,int); + int (*print)(struct DriverTCB*,char*,int); + int (*getsize)(struct DriverTCB*,int*,int*); + int (*setsize)(struct DriverTCB*,int,int); + void (*initacs)(struct DriverTCB*,chtype*,chtype*); + void (*scinit)(SCREEN *); + void (*scexit)(SCREEN *); + int (*twait)(struct DriverTCB*,int,int,int* EVENTLIST_2nd(_nc_eventlist*)); + int (*read)(struct DriverTCB*,int*); + int (*nap)(struct DriverTCB*,int); + int (*kpad)(struct DriverTCB*, bool); + int (*kyOk)(struct DriverTCB*, int, bool); + bool (*kyExist)(struct DriverTCB*, int); +} TERM_DRIVER; + + +typedef struct DriverTCB +{ + TERMINAL term; /* needs to be the first Element !!! */ + TERM_HANDLE inp; /* The input handle of the Terminal */ + TERM_HANDLE out; /* The output handle of the Terminal in shell mode */ + TERM_HANDLE hdl; /* The output handle of the Terminal in prog mode */ + TERM_DRIVER* drv; /* The driver for that Terminal */ + SCREEN* csp; /* The screen that owns that Terminal */ + TerminalInfo info; /* Driver independent core capabilities of the Terminal */ + void* prop; /* Driver dependent property storage to be used by the Driver */ + long magic; +} TERMINAL_CONTROL_BLOCK; + +#define NCDRV_MAGIC(id) (0x47110000 | (id&0xffff)) +#define NCDRV_TINFO 0x01 +#define NCDRV_WINCONSOLE 0x02 + +#define TCBOf(sp) ((TERMINAL_CONTROL_BLOCK*)(TerminalOf(sp))) +#define InfoOf(sp) TCBOf(sp)->info +#define CallDriver(sp,method) TCBOf(sp)->drv->method(TCBOf(sp)) +#define CallDriver_1(sp,method,arg1) TCBOf(sp)->drv->method(TCBOf(sp),arg1) +#define CallDriver_2(sp,method,arg1,arg2) TCBOf(sp)->drv->method(TCBOf(sp),arg1,arg2) +#define CallDriver_3(sp,method,arg1,arg2,arg3) TCBOf(sp)->drv->method(TCBOf(sp),arg1,arg2,arg3) +#define CallDriver_4(sp,method,arg1,arg2,arg3,arg4) TCBOf(sp)->drv->method(TCBOf(sp),arg1,arg2,arg3,arg4) + +extern NCURSES_EXPORT_VAR(const color_t*) _nc_cga_palette; +extern NCURSES_EXPORT_VAR(const color_t*) _nc_hls_palette; + +#ifdef __MINGW32__ +#include +extern NCURSES_EXPORT_VAR(TERM_DRIVER) _nc_WIN_DRIVER; +#endif +extern NCURSES_EXPORT_VAR(TERM_DRIVER) _nc_TINFO_DRIVER; + #define IsTermInfo(sp) TRUE #define HasTInfoTerminal(sp) ((0!=TerminalOf(sp)) && IsTermInfo(sp)) #define IsValidTIScreen(sp) (HasTInfoTerminal(sp)) @@ -1788,22 +1906,26 @@ extern NCURSES_EXPORT(WINDOW *) _nc_newscr_of(SCREEN*); extern NCURSES_EXPORT(WINDOW *) _nc_stdscr_of(SCREEN*); extern NCURSES_EXPORT(int) _nc_outc_wrapper(SCREEN*,int); -extern NCURSES_EXPORT(TERMINAL*) NCURSES_SP_NAME(_nc_set_curterm)(SCREEN*,TERMINAL*); +#if USE_REENTRANT +extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(_nc_ttytype)(SCREEN*); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_TABSIZE)(SCREEN*); +extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(longname)(SCREEN*); +#endif #if NCURSES_EXT_FUNCS extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_set_tabsize)(SCREEN*, int); #endif -extern NCURSES_EXPORT(chtype) NCURSES_SP_NAME(_nc_acs_char)(SCREEN*,int); - /* * We put the safe versions of various calls here as they are not published * part of the API up to now */ extern NCURSES_EXPORT(SCREEN*) _nc_SP(void); +extern NCURSES_EXPORT(TERMINAL*) NCURSES_SP_NAME(_nc_set_curterm)(SCREEN*,TERMINAL*); +extern NCURSES_EXPORT(TERMINAL*) NCURSES_SP_NAME(cur_term)(SCREEN *sp); extern NCURSES_EXPORT(WINDOW *) NCURSES_SP_NAME(_nc_makenew) (SCREEN*, int, int, int, int, int); -extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(_nc_is_term_resized)(SCREEN*,int,int); +extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(_nc_reset_colors)(SCREEN*); extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(_nc_printf_string)(SCREEN*, const char *, va_list); extern NCURSES_EXPORT(chtype) NCURSES_SP_NAME(_nc_acs_char)(SCREEN*,int); extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_curs_set)(SCREEN*,int); @@ -1815,8 +1937,6 @@ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_putp)(SCREEN*, 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*); extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_resize_term)(SCREEN*,int,int); -extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_resizeterm)(SCREEN*,int,int); -extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_restartterm)(SCREEN*,NCURSES_CONST char*,int,int*); extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_ripoffline)(SCREEN*, int, int (*)(WINDOW *,int)); extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_savetty)(SCREEN*); extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_scr_init)(SCREEN*,const char*); @@ -1828,12 +1948,11 @@ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_tgetent)(SCREEN*,char*,const extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_tigetnum)(SCREEN*,NCURSES_CONST char*); extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_tputs)(SCREEN*,const char*,int,int(*)(SCREEN*, int)); extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_vid_attr)(SCREEN *, attr_t, short, void *); -extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_vidattr)(SCREEN *, chtype); extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_vidputs)(SCREEN*,chtype,int(*) (SCREEN*, int)); extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_do_color)(SCREEN*, short, short, bool, int (*)(SCREEN*,int)); extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_do_xmc_glitch)(SCREEN*, attr_t); extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_flush)(SCREEN*); -extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_free_and_exit)(SCREEN*,int) GCC_NORETURN; +extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_free_and_exit)(SCREEN*, int) GCC_NORETURN; extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_freeall)(SCREEN*); extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_hash_map)(SCREEN*); extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_init_acs)(SCREEN*); diff --git a/ncurses/tinfo/lib_options.c b/ncurses/tinfo/lib_options.c index cfce6c94..b037ddcb 100644 --- a/ncurses/tinfo/lib_options.c +++ b/ncurses/tinfo/lib_options.c @@ -44,9 +44,8 @@ #include -MODULE_ID("$Id: lib_options.c,v 1.60 2009/02/28 21:07:56 tom Exp $") +MODULE_ID("$Id: lib_options.c,v 1.61 2009/05/02 21:19:53 tom Exp $") -static int _nc_curs_set(SCREEN *, int); static int _nc_meta(SCREEN *, bool); NCURSES_EXPORT(int) @@ -157,15 +156,44 @@ meta(WINDOW *win GCC_UNUSED, bool flag) /* curs_set() moved here to narrow the kernel interface */ NCURSES_EXPORT(int) -curs_set(int vis) +NCURSES_SP_NAME(curs_set) (NCURSES_SP_DCLx int vis) { - int result; + int result = ERR; + + T((T_CALLED("curs_set(%p,%d)"), SP_PARM, vis)); + if (SP_PARM != 0 && vis >= 0 && vis <= 2) { + int cursor = SP_PARM->_cursor; - T((T_CALLED("curs_set(%d)"), vis)); - result = _nc_curs_set(SP, vis); + if (vis == cursor) { + result = cursor; + } else { + switch (vis) { + case 2: + result = _nc_putp_flush("cursor_visible", cursor_visible); + break; + case 1: + result = _nc_putp_flush("cursor_normal", cursor_normal); + break; + case 0: + result = _nc_putp_flush("cursor_invisible", cursor_invisible); + break; + } + if (result != ERR) + result = (cursor == -1 ? 1 : cursor); + SP_PARM->_cursor = vis; + } + } returnCode(result); } +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +curs_set(int vis) +{ + return (NCURSES_SP_NAME(curs_set) (CURRENT_SCREEN, vis)); +} +#endif + NCURSES_EXPORT(int) NCURSES_SP_NAME(typeahead) (NCURSES_SP_DCLx int fd) { @@ -310,37 +338,6 @@ _nc_keypad(SCREEN *sp, bool flag) return (rc); } -static int -_nc_curs_set(SCREEN *sp, int vis) -{ - int result = ERR; - - T((T_CALLED("curs_set(%d)"), vis)); - if (sp != 0 && vis >= 0 && vis <= 2) { - int cursor = sp->_cursor; - - if (vis == cursor) { - result = cursor; - } else { - switch (vis) { - case 2: - result = _nc_putp_flush("cursor_visible", cursor_visible); - break; - case 1: - result = _nc_putp_flush("cursor_normal", cursor_normal); - break; - case 0: - result = _nc_putp_flush("cursor_invisible", cursor_invisible); - break; - } - if (result != ERR) - result = (cursor == -1 ? 1 : cursor); - sp->_cursor = vis; - } - } - returnCode(result); -} - static int _nc_meta(SCREEN *sp, bool flag) { diff --git a/ncurses/tinfo/lib_tputs.c b/ncurses/tinfo/lib_tputs.c index 0b12624e..c7061796 100644 --- a/ncurses/tinfo/lib_tputs.c +++ b/ncurses/tinfo/lib_tputs.c @@ -47,7 +47,7 @@ #include /* ospeed */ #include -MODULE_ID("$Id: lib_tputs.c,v 1.68 2009/02/28 21:08:18 tom Exp $") +MODULE_ID("$Id: lib_tputs.c,v 1.70 2009/05/02 20:54:22 tom Exp $") NCURSES_EXPORT_VAR(char) PC = 0; /* used by termcap library */ NCURSES_EXPORT_VAR(NCURSES_OSPEED) ospeed = 0; /* used by termcap library */ @@ -104,7 +104,7 @@ delay_output(int ms) NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_DCL0) { - (void) fflush(NC_OUTPUT); + (void) fflush(NC_OUTPUT(SP_PARM)); } #if NCURSES_SP_FUNCS @@ -127,9 +127,9 @@ NCURSES_SP_NAME(_nc_outch) (NCURSES_SP_DCLx int ch) * POSIX says write() is safe in a signal handler, but the * buffered I/O is not. */ - write(fileno(NC_OUTPUT), &tmp, 1); + write(fileno(NC_OUTPUT(SP_PARM)), &tmp, 1); } else { - putc(ch, NC_OUTPUT); + putc(ch, NC_OUTPUT(SP_PARM)); } return OK; } diff --git a/ncurses/tty/lib_mvcur.c b/ncurses/tty/lib_mvcur.c index 157f7eb6..2d724070 100644 --- a/ncurses/tty/lib_mvcur.c +++ b/ncurses/tty/lib_mvcur.c @@ -156,7 +156,7 @@ #include #include -MODULE_ID("$Id: lib_mvcur.c,v 1.117 2009/04/26 00:15:22 tom Exp $") +MODULE_ID("$Id: lib_mvcur.c,v 1.118 2009/05/02 20:38:58 tom Exp $") #define WANT_CHAR(sp, y, x) (sp)->_newscr->_line[y].text[x] /* desired state */ #define BAUDRATE(sp) cur_term->_baudrate /* bits per second */ @@ -265,8 +265,10 @@ reset_scroll_region(NCURSES_SP_DCL0) /* Set the scroll-region to a known state (the default) */ { if (change_scroll_region) { - TPUTS_TRACE("change_scroll_region"); - putp(TPARM_2(change_scroll_region, 0, screen_lines(CURRENT_SCREEN) - 1)); + NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx + "change_scroll_region", + TPARM_2(change_scroll_region, + 0, screen_lines(SP_PARM) - 1)); } } @@ -276,8 +278,9 @@ NCURSES_SP_NAME(_nc_mvcur_resume) (NCURSES_SP_DCL0) { /* initialize screen for cursor access */ if (enter_ca_mode) { - TPUTS_TRACE("enter_ca_mode"); - putp(enter_ca_mode); + NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx + "enter_ca_mode", + enter_ca_mode); } /* @@ -296,7 +299,7 @@ NCURSES_SP_NAME(_nc_mvcur_resume) (NCURSES_SP_DCL0) if (SP_PARM->_cursor != -1) { int cursor = SP_PARM->_cursor; SP_PARM->_cursor = -1; - curs_set(cursor); + NCURSES_SP_NAME(curs_set) (NCURSES_SP_ARGx cursor); } } @@ -312,7 +315,7 @@ NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_mvcur_init) (NCURSES_SP_DCL0) /* initialize the cost structure */ { - if (isatty(fileno(SP_PARM->_ofp))) + if (SP_PARM->_ofp && isatty(fileno(SP_PARM->_ofp))) SP_PARM->_char_padding = ((BAUDBYTE * 1000 * 10) / (BAUDRATE(SP_PARM) > 0 ? BAUDRATE(SP_PARM) @@ -410,7 +413,8 @@ NCURSES_SP_NAME(_nc_mvcur_init) (NCURSES_SP_DCL0) SP_PARM->_cup_ch_cost = NormalizedCost( TPARM_2(SP_PARM->_address_cursor, - 23, 23), 1); + 23, 23), + 1); SP_PARM->_hpa_ch_cost = NormalizedCost(TPARM_1(column_address, 23), 1); SP_PARM->_cuf_ch_cost = NormalizedCost(TPARM_1(parm_right_cursor, 23), 1); SP_PARM->_inline_cost = min(SP_PARM->_cup_ch_cost, @@ -458,13 +462,14 @@ NCURSES_SP_NAME(_nc_mvcur_wrap) (NCURSES_SP_DCL0) /* set cursor to normal mode */ if (SP_PARM->_cursor != -1) { int cursor = SP_PARM->_cursor; - curs_set(1); + NCURSES_SP_NAME(curs_set) (NCURSES_SP_ARGx 1); SP_PARM->_cursor = cursor; } if (exit_ca_mode) { - TPUTS_TRACE("exit_ca_mode"); - putp(exit_ca_mode); + NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx + "exit_ca_mode", + exit_ca_mode); } /* * Reset terminal's tab counter. There's a long-time bug that @@ -474,7 +479,7 @@ NCURSES_SP_NAME(_nc_mvcur_wrap) (NCURSES_SP_DCL0) * escape sequences that reset things as column positions. * Utter a \r to reset this invisibly. */ - _nc_outch('\r'); + NCURSES_SP_NAME(_nc_outch) (NCURSES_SP_ARGx '\r'); } #if NCURSES_SP_FUNCS @@ -801,8 +806,9 @@ onscreen_mvcur(NCURSES_SP_DCLx int yold, int xold, int ynew, int xnew, bool ovw) /* tactic #1: use local movement */ if (yold != -1 && xold != -1 && ((newcost = relative_move(NCURSES_SP_ARGx - NullResult, yold, xold, ynew, xnew, - ovw)) != INFINITY) + NullResult, + yold, xold, + ynew, xnew, ovw)) != INFINITY) && newcost < usecost) { tactic = 1; usecost = newcost; @@ -811,8 +817,9 @@ onscreen_mvcur(NCURSES_SP_DCLx int yold, int xold, int ynew, int xnew, bool ovw) /* tactic #2: use carriage-return + local movement */ if (yold != -1 && carriage_return && ((newcost = relative_move(NCURSES_SP_ARGx - NullResult, yold, 0, ynew, xnew, ovw)) - != INFINITY) + NullResult, + yold, 0, + ynew, xnew, ovw)) != INFINITY) && SP_PARM->_cr_cost + newcost < usecost) { tactic = 2; usecost = SP_PARM->_cr_cost + newcost; @@ -821,7 +828,9 @@ onscreen_mvcur(NCURSES_SP_DCLx int yold, int xold, int ynew, int xnew, bool ovw) /* tactic #3: use home-cursor + local movement */ if (cursor_home && ((newcost = relative_move(NCURSES_SP_ARGx - NullResult, 0, 0, ynew, xnew, ovw)) != INFINITY) + NullResult, + 0, 0, + ynew, xnew, ovw)) != INFINITY) && SP_PARM->_home_cost + newcost < usecost) { tactic = 3; usecost = SP_PARM->_home_cost + newcost; @@ -831,8 +840,8 @@ onscreen_mvcur(NCURSES_SP_DCLx int yold, int xold, int ynew, int xnew, bool ovw) if (cursor_to_ll && ((newcost = relative_move(NCURSES_SP_ARGx NullResult, - screen_lines(SP_PARM) - 1, 0, ynew, - xnew, ovw)) != INFINITY) + screen_lines(SP_PARM) - 1, 0, + ynew, xnew, ovw)) != INFINITY) && SP_PARM->_ll_cost + newcost < usecost) { tactic = 4; usecost = SP_PARM->_ll_cost + newcost; @@ -845,12 +854,10 @@ onscreen_mvcur(NCURSES_SP_DCLx int yold, int xold, int ynew, int xnew, bool ovw) t5_cr_cost = (xold > 0 ? SP_PARM->_cr_cost : 0); if (auto_left_margin && !eat_newline_glitch && yold > 0 && cursor_left - && ((newcost = relative_move(NCURSES_SP_ARGx NullResult, - yold - 1, - screen_columns(SP_PARM) - 1, - ynew, - xnew, - ovw)) != INFINITY) + && ((newcost = relative_move(NCURSES_SP_ARGx + NullResult, + yold - 1, screen_columns(SP_PARM) - 1, + ynew, xnew, ovw)) != INFINITY) && t5_cr_cost + SP_PARM->_cub1_cost + newcost < usecost) { tactic = 5; usecost = t5_cr_cost + SP_PARM->_cub1_cost + newcost; @@ -864,13 +871,15 @@ onscreen_mvcur(NCURSES_SP_DCLx int yold, int xold, int ynew, int xnew, bool ovw) switch (tactic) { case 1: (void) relative_move(NCURSES_SP_ARGx - &result, yold, xold, + &result, + yold, xold, ynew, xnew, ovw); break; case 2: (void) _nc_safe_strcpy(&result, carriage_return); (void) relative_move(NCURSES_SP_ARGx - &result, yold, 0, + &result, + yold, 0, ynew, xnew, ovw); break; case 3: @@ -881,7 +890,8 @@ onscreen_mvcur(NCURSES_SP_DCLx int yold, int xold, int ynew, int xnew, bool ovw) break; case 4: (void) _nc_safe_strcpy(&result, cursor_to_ll); - (void) relative_move(NCURSES_SP_ARGx &result, + (void) relative_move(NCURSES_SP_ARGx + &result, screen_lines(SP_PARM) - 1, 0, ynew, xnew, ovw); break; @@ -889,7 +899,8 @@ onscreen_mvcur(NCURSES_SP_DCLx int yold, int xold, int ynew, int xnew, bool ovw) if (xold > 0) (void) _nc_safe_strcat(&result, carriage_return); (void) _nc_safe_strcat(&result, cursor_left); - (void) relative_move(NCURSES_SP_ARGx &result, + (void) relative_move(NCURSES_SP_ARGx + &result, yold - 1, screen_columns(SP_PARM) - 1, ynew, xnew, ovw); break; @@ -955,7 +966,7 @@ NCURSES_SP_NAME(mvcur) (NCURSES_SP_DCLx TR(TRACE_CHARPUT, ("turning off (%#lx) %s before move", (unsigned long) AttrOf(oldattr), _traceattr(AttrOf(oldattr)))); - (void) VIDATTR(A_NORMAL, 0); + (void) VIDATTR(SP_PARM, A_NORMAL, 0); } if (xold >= screen_columns(SP_PARM)) { @@ -969,18 +980,20 @@ NCURSES_SP_NAME(mvcur) (NCURSES_SP_DCLx if (l > 0) { if (carriage_return) { - TPUTS_TRACE("carriage_return"); - putp(carriage_return); + NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx + "carriage_return", + carriage_return); } else - _nc_outch('\r'); + NCURSES_SP_NAME(_nc_outch) (NCURSES_SP_ARGx '\r'); xold = 0; while (l > 0) { if (newline) { - TPUTS_TRACE("newline"); - putp(newline); + NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx + "newline", + newline); } else - _nc_outch('\n'); + NCURSES_SP_NAME(_nc_outch) (NCURSES_SP_ARGx '\n'); l--; } } @@ -1009,7 +1022,7 @@ NCURSES_SP_NAME(mvcur) (NCURSES_SP_DCLx TR(TRACE_CHARPUT, ("turning on (%#lx) %s after move", (unsigned long) AttrOf(oldattr), _traceattr(AttrOf(oldattr)))); - (void) VIDATTR(AttrOf(oldattr), GetPair(oldattr)); + (void) VIDATTR(SP_PARM, AttrOf(oldattr), GetPair(oldattr)); } } returnCode(code); diff --git a/ncurses/tty/lib_vidattr.c b/ncurses/tty/lib_vidattr.c index 6c4f9e2f..83b6dbdf 100644 --- a/ncurses/tty/lib_vidattr.c +++ b/ncurses/tty/lib_vidattr.c @@ -66,7 +66,7 @@ #include #include -MODULE_ID("$Id: lib_vidattr.c,v 1.51 2009/02/21 21:43:40 tom Exp $") +MODULE_ID("$Id: lib_vidattr.c,v 1.53 2009/05/02 22:35:03 tom Exp $") #define doPut(mode) TPUTS_TRACE(#mode); tputs(mode, 1, outc) @@ -91,14 +91,16 @@ MODULE_ID("$Id: lib_vidattr.c,v 1.51 2009/02/21 21:43:40 tom Exp $") #define PreviousAttr _nc_prescreen.previous_attr NCURSES_EXPORT(int) -vidputs(chtype newmode, int (*outc) (int)) +NCURSES_SP_NAME(vidputs) (NCURSES_SP_DCLx + chtype newmode, + int (*outc) (int)) { attr_t turn_on, turn_off; int pair; bool reverse = FALSE; - bool can_color = (SP == 0 || SP->_coloron); + bool can_color = (SP_PARM == 0 || SP_PARM->_coloron); #if NCURSES_EXT_FUNCS - bool fix_pair0 = (SP != 0 && SP->_coloron && !SP->_default_color); + bool fix_pair0 = (SP_PARM != 0 && SP_PARM->_coloron && !SP_PARM->_default_color); #else #define fix_pair0 FALSE #endif @@ -107,12 +109,12 @@ vidputs(chtype newmode, int (*outc) (int)) T((T_CALLED("vidputs(%s)"), _traceattr(newmode))); /* this allows us to go on whether or not newterm() has been called */ - if (SP) - PreviousAttr = AttrOf(SCREEN_ATTRS(SP)); + if (SP_PARM) + PreviousAttr = AttrOf(SCREEN_ATTRS(SP_PARM)); TR(TRACE_ATTRS, ("previous attribute was %s", _traceattr(PreviousAttr))); - if ((SP != 0) + if ((SP_PARM != 0) && (magic_cookie_glitch > 0)) { #if USE_XMC_SUPPORT static const chtype table[] = @@ -136,7 +138,7 @@ vidputs(chtype newmode, int (*outc) (int)) * the terminfo max_attributes value. */ for (n = 0; n < SIZEOF(table); ++n) { - if ((table[n] & SP->_ok_attributes) == 0) { + if ((table[n] & SP_PARM->_ok_attributes) == 0) { newmode &= ~table[n]; } else if ((table[n] & newmode) != 0) { if (used++ >= limit) { @@ -149,7 +151,7 @@ vidputs(chtype newmode, int (*outc) (int)) } } #else - newmode &= ~(SP->_xmc_suppress); + newmode &= ~(SP_PARM->_xmc_suppress); #endif TR(TRACE_ATTRS, ("suppressed attribute is %s", _traceattr(newmode))); } @@ -209,10 +211,10 @@ vidputs(chtype newmode, int (*outc) (int)) if (exit_attribute_mode) { doPut(exit_attribute_mode); } else { - if (!SP || SP->_use_rmul) { + if (!SP_PARM || SP_PARM->_use_rmul) { TurnOff(A_UNDERLINE, exit_underline_mode); } - if (!SP || SP->_use_rmso) { + if (!SP_PARM || SP_PARM->_use_rmso) { TurnOff(A_STANDOUT, exit_standout_mode); } } @@ -242,11 +244,11 @@ vidputs(chtype newmode, int (*outc) (int)) TurnOff(A_ALTCHARSET, exit_alt_charset_mode); - if (!SP || SP->_use_rmul) { + if (!SP_PARM || SP_PARM->_use_rmul) { TurnOff(A_UNDERLINE, exit_underline_mode); } - if (!SP || SP->_use_rmso) { + if (!SP_PARM || SP_PARM->_use_rmso) { TurnOff(A_STANDOUT, exit_standout_mode); } @@ -283,14 +285,28 @@ vidputs(chtype newmode, int (*outc) (int)) if (reverse) newmode |= A_REVERSE; - if (SP) - SetAttr(SCREEN_ATTRS(SP), newmode); + if (SP_PARM) + SetAttr(SCREEN_ATTRS(SP_PARM), newmode); else PreviousAttr = newmode; returnCode(OK); } +NCURSES_EXPORT(int) +NCURSES_SP_NAME(vidattr) (NCURSES_SP_DCLx + chtype newmode) +{ + return NCURSES_SP_NAME(vidputs) (NCURSES_SP_ARGx newmode, _nc_outch); +} + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +vidputs(chtype newmode, int (*outc) (int)) +{ + return NCURSES_SP_NAME(vidputs) (CURRENT_SCREEN, newmode, outc); +} + NCURSES_EXPORT(int) vidattr(chtype newmode) { @@ -298,6 +314,7 @@ vidattr(chtype newmode) returnCode(vidputs(newmode, _nc_outch)); } +#endif NCURSES_EXPORT(chtype) NCURSES_SP_NAME(termattrs) (NCURSES_SP_DCL0) diff --git a/ncurses/tty/tty_update.c b/ncurses/tty/tty_update.c index 5ba824b7..cabca530 100644 --- a/ncurses/tty/tty_update.c +++ b/ncurses/tty/tty_update.c @@ -78,7 +78,7 @@ #include -MODULE_ID("$Id: tty_update.c,v 1.251 2009/04/25 23:46:09 tom Exp $") +MODULE_ID("$Id: tty_update.c,v 1.252 2009/05/02 20:52:11 tom Exp $") /* * This define controls the line-breakout optimization. Every once in a @@ -439,7 +439,7 @@ wrap_cursor(NCURSES_SP_DCL0) TR(TRACE_CHARPUT, ("turning off (%#lx) %s before wrapping", (unsigned long) AttrOf(SCREEN_ATTRS(SP_PARM)), _traceattr(AttrOf(SCREEN_ATTRS(SP_PARM))))); - (void) VIDATTR(A_NORMAL, 0); + (void) VIDATTR(SP_PARM, A_NORMAL, 0); } } else { SP_PARM->_curscol--; @@ -2002,7 +2002,7 @@ NCURSES_SP_NAME(_nc_screen_resume) (NCURSES_SP_DCL0) /* reset color pairs and definitions */ if (SP_PARM->_coloron || SP_PARM->_color_defs) - _nc_reset_colors (); + _nc_reset_colors(); /* restore user-defined colors, if any */ if (SP_PARM->_color_defs < 0) { @@ -2081,7 +2081,7 @@ NCURSES_SP_NAME(_nc_screen_wrap) (NCURSES_SP_DCL0) } #endif if (SP_PARM->_color_defs) { - _nc_reset_colors (); + _nc_reset_colors(); } } diff --git a/ncurses/widechar/lib_vid_attr.c b/ncurses/widechar/lib_vid_attr.c index 1dc679e6..0b5648b0 100644 --- a/ncurses/widechar/lib_vid_attr.c +++ b/ncurses/widechar/lib_vid_attr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2002-2006,2007 Free Software Foundation, Inc. * + * Copyright (c) 2002-2007,2009 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -33,7 +33,7 @@ #include #include -MODULE_ID("$Id: lib_vid_attr.c,v 1.5 2007/06/30 22:03:02 tom Exp $") +MODULE_ID("$Id: lib_vid_attr.c,v 1.7 2009/05/02 23:30:44 tom Exp $") #define doPut(mode) TPUTS_TRACE(#mode); tputs(mode, 1, outc) @@ -57,7 +57,11 @@ MODULE_ID("$Id: lib_vid_attr.c,v 1.5 2007/06/30 22:03:02 tom Exp $") #define set_color(mode, pair) mode &= ALL_BUT_COLOR; mode |= COLOR_PAIR(pair) NCURSES_EXPORT(int) -vid_puts(attr_t newmode, short pair, void *opts GCC_UNUSED, int (*outc) (int)) +NCURSES_SP_NAME(vid_puts)(NCURSES_SP_DCLx + attr_t newmode, + short pair, + void *opts GCC_UNUSED, + int (*outc) (int)) { #if NCURSES_EXT_COLORS static attr_t previous_attr = A_NORMAL; @@ -65,9 +69,9 @@ vid_puts(attr_t newmode, short pair, void *opts GCC_UNUSED, int (*outc) (int)) attr_t turn_on, turn_off; bool reverse = FALSE; - bool can_color = (SP == 0 || SP->_coloron); + bool can_color = (SP_PARM == 0 || SP_PARM->_coloron); #if NCURSES_EXT_FUNCS - bool fix_pair0 = (SP != 0 && SP->_coloron && !SP->_default_color); + bool fix_pair0 = (SP_PARM != 0 && SP_PARM->_coloron && !SP_PARM->_default_color); #else #define fix_pair0 FALSE #endif @@ -76,18 +80,18 @@ vid_puts(attr_t newmode, short pair, void *opts GCC_UNUSED, int (*outc) (int)) T((T_CALLED("vid_puts(%s,%d)"), _traceattr(newmode), pair)); /* this allows us to go on whether or not newterm() has been called */ - if (SP) { - previous_attr = AttrOf(SCREEN_ATTRS(SP)); - previous_pair = GetPair(SCREEN_ATTRS(SP)); + if (SP_PARM) { + previous_attr = AttrOf(SCREEN_ATTRS(SP_PARM)); + previous_pair = GetPair(SCREEN_ATTRS(SP_PARM)); } TR(TRACE_ATTRS, ("previous attribute was %s, %d", _traceattr(previous_attr), previous_pair)); #if !USE_XMC_SUPPORT - if ((SP != 0) + if ((SP_PARM != 0) && (magic_cookie_glitch > 0)) - newmode &= ~(SP->_xmc_suppress); + newmode &= ~(SP_PARM->_xmc_suppress); #endif /* @@ -144,10 +148,10 @@ vid_puts(attr_t newmode, short pair, void *opts GCC_UNUSED, int (*outc) (int)) if (exit_attribute_mode) { doPut(exit_attribute_mode); } else { - if (!SP || SP->_use_rmul) { + if (!SP_PARM || SP_PARM->_use_rmul) { TurnOff(A_UNDERLINE, exit_underline_mode); } - if (!SP || SP->_use_rmso) { + if (!SP_PARM || SP_PARM->_use_rmso) { TurnOff(A_STANDOUT, exit_standout_mode); } } @@ -179,11 +183,11 @@ vid_puts(attr_t newmode, short pair, void *opts GCC_UNUSED, int (*outc) (int)) TurnOff(A_ALTCHARSET, exit_alt_charset_mode); - if (!SP || SP->_use_rmul) { + if (!SP_PARM || SP_PARM->_use_rmul) { TurnOff(A_UNDERLINE, exit_underline_mode); } - if (!SP || SP->_use_rmso) { + if (!SP_PARM || SP_PARM->_use_rmso) { TurnOff(A_STANDOUT, exit_standout_mode); } @@ -221,9 +225,9 @@ vid_puts(attr_t newmode, short pair, void *opts GCC_UNUSED, int (*outc) (int)) if (reverse) newmode |= A_REVERSE; - if (SP) { - SetAttr(SCREEN_ATTRS(SP), newmode); - SetPair(SCREEN_ATTRS(SP), pair); + if (SP_PARM) { + SetAttr(SCREEN_ATTRS(SP_PARM), newmode); + SetPair(SCREEN_ATTRS(SP_PARM), pair); } else { previous_attr = newmode; previous_pair = pair; @@ -239,12 +243,29 @@ vid_puts(attr_t newmode, short pair, void *opts GCC_UNUSED, int (*outc) (int)) #undef vid_attr NCURSES_EXPORT(int) -vid_attr(attr_t newmode, short pair, void *opts) +NCURSES_SP_NAME(vid_attr) (NCURSES_SP_DCLx + attr_t newmode, + short pair, + void *opts) { T((T_CALLED("vid_attr(%s,%d)"), _traceattr(newmode), pair)); returnCode(vid_puts(newmode, pair, opts, _nc_outch)); } +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +vid_puts(attr_t newmode, short pair, void *opts GCC_UNUSED, int (*outc) (int)) +{ + return NCURSES_SP_NAME(vid_puts) (CURRENT_SCREEN, newmode, pair, opts, outc); +} + +NCURSES_EXPORT(int) +vid_attr(attr_t newmode, short pair, void *opts) +{ + return NCURSES_SP_NAME(vid_attr) (CURRENT_SCREEN, newmode, pair, opts); +} +#endif + /* * This implementation uses the same mask values for A_xxx and WA_xxx, so * we can use termattrs() for part of the logic. diff --git a/test/ditto.c b/test/ditto.c index b8aebac9..c658de71 100644 --- a/test/ditto.c +++ b/test/ditto.c @@ -29,7 +29,7 @@ /* * Author: Thomas E. Dickey (1998-on) * - * $Id: ditto.c,v 1.32 2008/08/04 13:21:41 tom Exp $ + * $Id: ditto.c,v 1.33 2008/11/16 00:19:59 juergen Exp $ * * The program illustrates how to set up multiple screens from a single * program. @@ -137,8 +137,8 @@ peek_fifo(FIFO * fifo, PEEK * peek) { int result = -1; if (peek->sequence < fifo->sequence) { - peek->sequence += 1; result = fifo->data[THIS_FIFO(peek->sequence)]; + peek->sequence += 1; } return result; } @@ -188,7 +188,11 @@ open_tty(char *path) } static void -init_screen(SCREEN *sp GCC_UNUSED, void *arg) +init_screen( +#if HAVE_USE_WINDOW + SCREEN *sp GCC_UNUSED, +#endif + void *arg) { DITTO *target = (DITTO *) arg; int high, wide; @@ -237,6 +241,7 @@ open_screen(DITTO * target, char **source, int length, int which1) target->which1 = which1; target->titles = source; target->length = length; + target->fifo.head = -1; target->screen = newterm((char *) 0, /* assume $TERM is the same */ target->output, target->input); @@ -248,7 +253,11 @@ open_screen(DITTO * target, char **source, int length, int which1) } static int -close_screen(SCREEN *sp GCC_UNUSED, void *arg GCC_UNUSED) +close_screen( +#if HAVE_USE_WINDOW + SCREEN *sp GCC_UNUSED, +#endif + void *arg GCC_UNUSED) { (void) sp; (void) arg; @@ -259,7 +268,11 @@ close_screen(SCREEN *sp GCC_UNUSED, void *arg GCC_UNUSED) * Read data from the 'source' screen. */ static int -read_screen(SCREEN *sp GCC_UNUSED, void *arg) +read_screen( +#if HAVE_USE_WINDOW + SCREEN *sp GCC_UNUSED, +#endif + void *arg) { DDATA *data = (DDATA *) arg; DITTO *ditto = &(data->ditto[data->source]); @@ -278,7 +291,11 @@ read_screen(SCREEN *sp GCC_UNUSED, void *arg) * Write all of the data that's in fifos for the 'target' screen. */ static int -write_screen(SCREEN *sp GCC_UNUSED, void *arg GCC_UNUSED) +write_screen( +#if HAVE_USE_WINDOW + SCREEN *sp GCC_UNUSED, +#endif + void *arg GCC_UNUSED) { DDATA *data = (DDATA *) arg; DITTO *ditto = &(data->ditto[data->target]); @@ -360,7 +377,7 @@ main(int argc, char *argv[]) if (argc <= 1) usage(); - + if ((data = typeCalloc(DITTO, (size_t) argc)) == 0) failed("calloc data"); diff --git a/test/ncurses.c b/test/ncurses.c index c1f700ca..c99485b7 100644 --- a/test/ncurses.c +++ b/test/ncurses.c @@ -40,7 +40,7 @@ AUTHOR Author: Eric S. Raymond 1993 Thomas E. Dickey (beginning revision 1.27 in 1996). -$Id: ncurses.c,v 1.338 2009/03/28 21:40:51 tom Exp $ +$Id: ncurses.c,v 1.339 2009/04/04 22:46:11 juergen Exp $ ***************************************************************************/ @@ -483,7 +483,11 @@ ShellOut(bool message) addstr("Shelling out..."); def_prog_mode(); endwin(); +#ifdef __MINGW32__ + system("cmd.exe"); +#else system("sh"); +#endif if (message) addstr("returned from shellout.\n"); refresh(); @@ -924,6 +928,7 @@ getch_test(void) wgetch_test(0, stdscr, delay); forget_boxes(); finish_getch_test(); + slk_clear(); } #if USE_WIDEC_SUPPORT @@ -1141,6 +1146,7 @@ get_wch_test(void) wget_wch_test(0, stdscr, delay); forget_boxes(); finish_getch_test(); + slk_clear(); } #endif diff --git a/test/test.priv.h b/test/test.priv.h index 18e163c5..f62a930d 100644 --- a/test/test.priv.h +++ b/test/test.priv.h @@ -29,7 +29,7 @@ /**************************************************************************** * Author: Thomas E. Dickey 1996-on * ****************************************************************************/ -/* $Id: test.priv.h,v 1.80 2008/12/20 16:37:20 tom Exp $ */ +/* $Id: test.priv.h,v 1.81 2008/12/28 20:20:39 juergen Exp $ */ #ifndef __TEST_PRIV_H #define __TEST_PRIV_H 1 @@ -467,6 +467,14 @@ extern int optind; #define EXIT_FAILURE 1 #endif +#ifdef __MINGW32__ +#include +/* conflicts in test/firstlast.c */ +#undef large +#undef small + +#endif + /* Use this to quiet gcc's -Wwrite-strings warnings, but accommodate SVr4 * curses which doesn't have const parameters declared (so far) in the places * that XSI shows. @@ -563,7 +571,7 @@ typedef int (*NCURSES_SCREEN_CB)(SCREEN *, void *); #define USING_SCREEN(s,func,data) use_screen(s, (NCURSES_SCREEN_CB) func, data) #define WANT_USE_SCREEN() extern void _nc_want_use_screen(void) #else -#define USING_SCREEN(s,func,data) func(s,data) +#define USING_SCREEN(s,func,data) func(data) #define WANT_USE_SCREEN() extern void _nc_want_use_screen(void) #endif diff --git a/test/view.c b/test/view.c index 9f2d72f6..fe3a2114 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.69 2008/09/06 22:10:50 tom Exp $ + * $Id: view.c,v 1.70 2008/11/16 00:19:59 juergen Exp $ */ #include @@ -62,8 +62,10 @@ #if HAVE_TERMIOS_H # include #else +#if !defined(__MINGW32__) # include #endif +#endif #if !defined(sun) || !HAVE_TERMIOS_H # if HAVE_SYS_IOCTL_H diff --git a/test/worm.c b/test/worm.c index 2029b34f..0bcd8d3d 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.58 2008/10/04 21:54:09 tom Exp $ + $Id: worm.c,v 1.59 2008/11/16 00:19:59 juergen Exp $ */ #include @@ -330,7 +330,11 @@ start_worm(void *arg) while (!quit_worm(((struct worm *) arg) - worm)) { while (compare < sequence) { ++compare; +#if HAVE_USE_WINDOW use_window(stdscr, draw_worm, arg); +#else + draw_worm(stdscr, arg); +#endif } } Trace(("...start_worm (done)")); @@ -356,7 +360,13 @@ draw_all_worms(void) } #else for (n = 0, w = &worm[0]; n < number; n++, w++) { - if (USING_WINDOW2(stdscr, draw_worm, w)) + if ( +#if HAVE_USE_WINDOW + USING_WINDOW2(stdscr, draw_worm, w) +#else + draw_worm(stdscr, w) +#endif + ) done = TRUE; } #endif