mirror of
https://github.com/Aigor44/ncursesw-morphos.git
synced 2025-01-24 15:13:56 +08:00
ncurses 5.7 - patch 20100116
+ modify win_driver.c to initialize acs_map for win32 console, so that line-drawing works. + modify win_driver.c to initialize TERMINAL struct so that programs such as test/lrtest.c and test/ncurses.c which test string capabilities can run. + modify term-driver modules to eliminate forward-reference declarations.
This commit is contained in:
parent
77afe78361
commit
c04d54322f
11
NEWS
11
NEWS
@ -25,7 +25,7 @@
|
||||
-- sale, use or other dealings in this Software without prior written --
|
||||
-- authorization. --
|
||||
-------------------------------------------------------------------------------
|
||||
-- $Id: NEWS,v 1.1491 2010/01/09 21:05:27 tom Exp $
|
||||
-- $Id: NEWS,v 1.1493 2010/01/16 23:47:10 tom Exp $
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
This is a log of changes that ncurses has gone through since Zeyd started
|
||||
@ -45,6 +45,15 @@ 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.
|
||||
|
||||
20100116
|
||||
+ modify win_driver.c to initialize acs_map for win32 console, so
|
||||
that line-drawing works.
|
||||
+ modify win_driver.c to initialize TERMINAL struct so that programs
|
||||
such as test/lrtest.c and test/ncurses.c which test string
|
||||
capabilities can run.
|
||||
+ modify term-driver modules to eliminate forward-reference
|
||||
declarations.
|
||||
|
||||
20100109
|
||||
+ modify configure macro CF_XOPEN_SOURCE, etc., to use CF_ADD_CFLAGS
|
||||
consistently to add new -D's while removing duplicates.
|
||||
|
4
dist.mk
4
dist.mk
@ -25,7 +25,7 @@
|
||||
# use or other dealings in this Software without prior written #
|
||||
# authorization. #
|
||||
##############################################################################
|
||||
# $Id: dist.mk,v 1.741 2010/01/09 16:28:29 tom Exp $
|
||||
# $Id: dist.mk,v 1.742 2010/01/16 15:13:42 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 = 20100109
|
||||
NCURSES_PATCH = 20100116
|
||||
|
||||
# We don't append the patch to the version, since this only applies to releases
|
||||
VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* Copyright (c) 2008,2009 Free Software Foundation, Inc. *
|
||||
* Copyright (c) 2008-2009,2010 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 <curses.priv.h>
|
||||
|
||||
MODULE_ID("$Id: lib_driver.c,v 1.1 2009/02/21 15:11:29 juergen Exp $")
|
||||
MODULE_ID("$Id: lib_driver.c,v 1.2 2010/01/16 21:26:09 tom Exp $")
|
||||
|
||||
typedef struct DriverEntry {
|
||||
const char *name;
|
||||
@ -48,19 +48,19 @@ static DRIVER_ENTRY DriverTable[] =
|
||||
{"tinfo", &_nc_TINFO_DRIVER}
|
||||
};
|
||||
|
||||
#define NUM_DRIVERS (int)(sizeof(DriverTable)/sizeof(DRIVER_ENTRY))
|
||||
|
||||
NCURSES_EXPORT(int)
|
||||
_nc_get_driver(TERMINAL_CONTROL_BLOCK * TCB, const char *name, int *errret)
|
||||
{
|
||||
int code = ERR;
|
||||
int i;
|
||||
size_t i;
|
||||
TERM_DRIVER *res = (TERM_DRIVER *) 0;
|
||||
TERM_DRIVER *use = 0;
|
||||
|
||||
T((T_CALLED("_nc_get_driver(%p, %s, %p)"), TCB, NonNull(name), errret));
|
||||
|
||||
assert(TCB != 0);
|
||||
|
||||
for (i = 0; i < NUM_DRIVERS; i++) {
|
||||
for (i = 0; i < SIZEOF(DriverTable); i++) {
|
||||
res = DriverTable[i].driver;
|
||||
if (res->CanHandle(TCB, name, errret)) {
|
||||
use = res;
|
||||
@ -71,7 +71,7 @@ _nc_get_driver(TERMINAL_CONTROL_BLOCK * TCB, const char *name, int *errret)
|
||||
TCB->drv = use;
|
||||
code = OK;
|
||||
}
|
||||
return (code);
|
||||
returnCode(code);
|
||||
}
|
||||
|
||||
NCURSES_EXPORT(int)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. *
|
||||
* Copyright (c) 1998-2009,2010 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 *
|
||||
@ -35,7 +35,7 @@
|
||||
|
||||
|
||||
/*
|
||||
* $Id: curses.priv.h,v 1.445 2009/12/05 21:20:51 tom Exp $
|
||||
* $Id: curses.priv.h,v 1.447 2010/01/16 21:32:59 tom Exp $
|
||||
*
|
||||
* curses.priv.h
|
||||
*
|
||||
@ -1440,11 +1440,14 @@ extern NCURSES_EXPORT(void) _nc_locked_tracef (const char *, ...) GCC_PRINTFLIKE
|
||||
#define T(a) TR(TRACE_CALLS, a)
|
||||
#define TRACE_RETURN(value,type) return _nc_retrace_##type(value)
|
||||
|
||||
#define NonNull(s) ((s) != 0 ? s : "<null>")
|
||||
|
||||
#define returnAttr(code) TRACE_RETURN(code,attr_t)
|
||||
#define returnBits(code) TRACE_RETURN(code,unsigned)
|
||||
#define returnBool(code) TRACE_RETURN(code,bool)
|
||||
#define returnCPtr(code) TRACE_RETURN(code,cptr)
|
||||
#define returnCVoidPtr(code) TRACE_RETURN(code,cvoid_ptr)
|
||||
#define returnChar(code) TRACE_RETURN(code,char)
|
||||
#define returnChtype(code) TRACE_RETURN(code,chtype)
|
||||
#define returnCode(code) TRACE_RETURN(code,int)
|
||||
#define returnPtr(code) TRACE_RETURN(code,ptr)
|
||||
@ -1464,6 +1467,7 @@ extern NCURSES_EXPORT(char *) _nc_varargs (const char *, va_list);
|
||||
extern NCURSES_EXPORT(chtype) _nc_retrace_chtype (chtype);
|
||||
extern NCURSES_EXPORT(const char *) _nc_altcharset_name(attr_t, chtype);
|
||||
extern NCURSES_EXPORT(const char *) _nc_retrace_cptr (const char *);
|
||||
extern NCURSES_EXPORT(char) _nc_retrace_char (char);
|
||||
extern NCURSES_EXPORT(int) _nc_retrace_int (int);
|
||||
extern NCURSES_EXPORT(unsigned) _nc_retrace_unsigned (unsigned);
|
||||
extern NCURSES_EXPORT(void *) _nc_retrace_void_ptr (void *);
|
||||
@ -1504,6 +1508,7 @@ extern NCURSES_EXPORT(const char *) _nc_viscbuf (const NCURSES_CH_T *, int);
|
||||
#define returnBool(code) return code
|
||||
#define returnCPtr(code) return code
|
||||
#define returnCVoidPtr(code) return code
|
||||
#define returnChar(code) return ((char) code)
|
||||
#define returnChtype(code) return code
|
||||
#define returnCode(code) return code
|
||||
#define returnPtr(code) return code
|
||||
|
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. *
|
||||
* Copyright (c) 1998-2009,2010 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 *
|
||||
@ -93,7 +93,7 @@
|
||||
#include <ctype.h>
|
||||
#include <tic.h>
|
||||
|
||||
MODULE_ID("$Id: captoinfo.c,v 1.53 2009/03/28 20:44:23 tom Exp $")
|
||||
MODULE_ID("$Id: captoinfo.c,v 1.54 2010/01/16 17:12:19 tom Exp $")
|
||||
|
||||
#define MAX_PUSHED 16 /* max # args we can push onto the stack */
|
||||
|
||||
@ -125,7 +125,7 @@ init_string(void)
|
||||
static char *
|
||||
save_string(char *d, const char *const s)
|
||||
{
|
||||
size_t have = (d - my_string);
|
||||
size_t have = (size_t) (d - my_string);
|
||||
size_t need = have + strlen(s) + 2;
|
||||
if (need > my_length) {
|
||||
my_string = (char *) _nc_doalloc(my_string, my_length = (need + need));
|
||||
@ -196,7 +196,7 @@ cvtchar(register const char *sp)
|
||||
case '3':
|
||||
len = 1;
|
||||
while (isdigit(UChar(*sp))) {
|
||||
c = 8 * c + (*sp++ - '0');
|
||||
c = (unsigned char) (8 * c + (*sp++ - '0'));
|
||||
len++;
|
||||
}
|
||||
break;
|
||||
@ -207,7 +207,7 @@ cvtchar(register const char *sp)
|
||||
}
|
||||
break;
|
||||
case '^':
|
||||
c = (*++sp & 0x1f);
|
||||
c = (unsigned char) (*++sp & 0x1f);
|
||||
len = 2;
|
||||
break;
|
||||
default:
|
||||
|
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
|
||||
* Copyright (c) 1998-2008,2010 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 *
|
||||
@ -35,7 +35,7 @@
|
||||
#include <ctype.h>
|
||||
#include <tic.h>
|
||||
|
||||
MODULE_ID("$Id: comp_expand.c,v 1.20 2008/08/16 19:29:42 tom Exp $")
|
||||
MODULE_ID("$Id: comp_expand.c,v 1.21 2010/01/16 17:11:23 tom Exp $")
|
||||
|
||||
static int
|
||||
trailing_spaces(const char *src)
|
||||
@ -91,7 +91,7 @@ _nc_tic_expand(const char *srcp, bool tic_format, int numbers)
|
||||
&& REALPRINT(str + 1)
|
||||
&& str[2] == S_QUOTE) {
|
||||
sprintf(buffer + bufp, "{%d}", str[1]);
|
||||
bufp += strlen(buffer + bufp);
|
||||
bufp += (int) strlen(buffer + bufp);
|
||||
str += 2;
|
||||
} else {
|
||||
buffer[bufp++] = *str;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* Copyright (c) 1998-2006,2008 Free Software Foundation, Inc. *
|
||||
* Copyright (c) 1998-2008,2010 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 <term_entry.h>
|
||||
#include <tic.h>
|
||||
|
||||
MODULE_ID("$Id: comp_scan.c,v 1.84 2009/05/09 16:37:42 tom Exp $")
|
||||
MODULE_ID("$Id: comp_scan.c,v 1.85 2010/01/16 17:02:17 tom Exp $")
|
||||
|
||||
/*
|
||||
* Maximum length of string capability we'll accept before raising an error.
|
||||
@ -424,7 +424,7 @@ _nc_get_token(bool silent)
|
||||
&& !strchr(terminfo_punct, (char) ch)) {
|
||||
if (!silent)
|
||||
_nc_warning("Illegal character (expected alphanumeric or %s) - '%s'",
|
||||
terminfo_punct, unctrl((chtype) ch));
|
||||
terminfo_punct, unctrl(UChar(ch)));
|
||||
_nc_panic_mode(separator);
|
||||
goto start_token;
|
||||
}
|
||||
@ -589,7 +589,7 @@ _nc_get_token(bool silent)
|
||||
case '@':
|
||||
if ((ch = next_char()) != separator && !silent)
|
||||
_nc_warning("Missing separator after `%s', have %s",
|
||||
tok_buf, unctrl((chtype) ch));
|
||||
tok_buf, unctrl(UChar(ch)));
|
||||
_nc_curr_token.tk_name = tok_buf;
|
||||
type = CANCEL;
|
||||
break;
|
||||
@ -630,8 +630,7 @@ _nc_get_token(bool silent)
|
||||
/* just to get rid of the compiler warning */
|
||||
type = UNDEF;
|
||||
if (!silent)
|
||||
_nc_warning("Illegal character - '%s'",
|
||||
unctrl((chtype) ch));
|
||||
_nc_warning("Illegal character - '%s'", unctrl(UChar(ch)));
|
||||
}
|
||||
} /* end else (first_column == FALSE) */
|
||||
} /* end else (ch != EOF) */
|
||||
@ -724,48 +723,47 @@ _nc_trans_string(char *ptr, char *last)
|
||||
int count = 0;
|
||||
int number = 0;
|
||||
int i, c;
|
||||
chtype ch, last_ch = '\0';
|
||||
int last_ch = '\0';
|
||||
bool ignored = FALSE;
|
||||
bool long_warning = FALSE;
|
||||
|
||||
while ((ch = c = next_char()) != (chtype) separator && c != EOF) {
|
||||
while ((c = next_char()) != separator && c != EOF) {
|
||||
if (ptr >= (last - 1)) {
|
||||
if (c != EOF) {
|
||||
while ((c = next_char()) != separator && c != EOF) {
|
||||
;
|
||||
}
|
||||
ch = c;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if ((_nc_syntax == SYN_TERMCAP) && c == '\n')
|
||||
break;
|
||||
if (ch == '^' && last_ch != '%') {
|
||||
ch = c = next_char();
|
||||
if (c == '^' && last_ch != '%') {
|
||||
c = next_char();
|
||||
if (c == EOF)
|
||||
_nc_err_abort(MSG_NO_INPUTS);
|
||||
|
||||
if (!(is7bits(ch) && isprint(ch))) {
|
||||
_nc_warning("Illegal ^ character - '%s'", unctrl(ch));
|
||||
if (!(is7bits(c) && isprint(c))) {
|
||||
_nc_warning("Illegal ^ character - '%s'", unctrl(UChar(c)));
|
||||
}
|
||||
if (ch == '?') {
|
||||
if (c == '?') {
|
||||
*(ptr++) = '\177';
|
||||
if (_nc_tracing)
|
||||
_nc_warning("Allow ^? as synonym for \\177");
|
||||
} else {
|
||||
if ((ch &= 037) == 0)
|
||||
ch = 128;
|
||||
*(ptr++) = (char) (ch);
|
||||
if ((c &= 037) == 0)
|
||||
c = 128;
|
||||
*(ptr++) = (char) (c);
|
||||
}
|
||||
} else if (ch == '\\') {
|
||||
ch = c = next_char();
|
||||
} else if (c == '\\') {
|
||||
c = next_char();
|
||||
if (c == EOF)
|
||||
_nc_err_abort(MSG_NO_INPUTS);
|
||||
|
||||
if (ch >= '0' && ch <= '7') {
|
||||
number = ch - '0';
|
||||
if (c >= '0' && c <= '7') {
|
||||
number = c - '0';
|
||||
for (i = 0; i < 2; i++) {
|
||||
ch = c = next_char();
|
||||
c = next_char();
|
||||
if (c == EOF)
|
||||
_nc_err_abort(MSG_NO_INPUTS);
|
||||
|
||||
@ -842,31 +840,31 @@ _nc_trans_string(char *ptr, char *last)
|
||||
|
||||
default:
|
||||
_nc_warning("Illegal character '%s' in \\ sequence",
|
||||
unctrl(ch));
|
||||
unctrl(UChar(c)));
|
||||
/* FALLTHRU */
|
||||
case '|':
|
||||
*(ptr++) = (char) ch;
|
||||
} /* endswitch (ch) */
|
||||
} /* endelse (ch < '0' || ch > '7') */
|
||||
*(ptr++) = (char) c;
|
||||
} /* endswitch (c) */
|
||||
} /* endelse (c < '0' || c > '7') */
|
||||
}
|
||||
/* end else if (ch == '\\') */
|
||||
else if (ch == '\n' && (_nc_syntax == SYN_TERMINFO)) {
|
||||
/* end else if (c == '\\') */
|
||||
else if (c == '\n' && (_nc_syntax == SYN_TERMINFO)) {
|
||||
/*
|
||||
* Newlines embedded in a terminfo string are ignored, provided
|
||||
* that the next line begins with whitespace.
|
||||
*/
|
||||
ignored = TRUE;
|
||||
} else {
|
||||
*(ptr++) = (char) ch;
|
||||
*(ptr++) = (char) c;
|
||||
}
|
||||
|
||||
if (!ignored) {
|
||||
if (_nc_curr_col <= 1) {
|
||||
push_back((char) ch);
|
||||
ch = '\n';
|
||||
push_back((char) c);
|
||||
c = '\n';
|
||||
break;
|
||||
}
|
||||
last_ch = ch;
|
||||
last_ch = c;
|
||||
count++;
|
||||
}
|
||||
ignored = FALSE;
|
||||
@ -879,7 +877,7 @@ _nc_trans_string(char *ptr, char *last)
|
||||
|
||||
*ptr = '\0';
|
||||
|
||||
return (ch);
|
||||
return (c);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* Copyright (c) 1999-2008,2009 Free Software Foundation, Inc. *
|
||||
* Copyright (c) 1999-2009,2010 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 *
|
||||
@ -31,7 +31,7 @@
|
||||
|
||||
#include <term_entry.h>
|
||||
|
||||
MODULE_ID("$Id: init_keytry.c,v 1.14 2009/05/10 00:48:29 tom Exp $")
|
||||
MODULE_ID("$Id: init_keytry.c,v 1.15 2010/01/16 17:20:34 tom Exp $")
|
||||
|
||||
/*
|
||||
** _nc_init_keytry()
|
||||
@ -45,7 +45,7 @@ MODULE_ID("$Id: init_keytry.c,v 1.14 2009/05/10 00:48:29 tom Exp $")
|
||||
* than cur_term.
|
||||
*/
|
||||
#undef CUR
|
||||
#define CUR SP_TERMTYPE
|
||||
#define CUR SP_TERMTYPE
|
||||
|
||||
#if BROKEN_LINKER
|
||||
#undef _nc_tinfo_fkeys
|
||||
@ -92,7 +92,7 @@ _nc_init_keytry(SCREEN *sp)
|
||||
{
|
||||
TERMTYPE *tp = &(sp->_term->type);
|
||||
for (n = STRCOUNT; n < NUM_STRINGS(tp); ++n) {
|
||||
const char *name = ExtStrname(tp, n, strnames);
|
||||
const char *name = ExtStrname(tp, (size_t) n, strnames);
|
||||
char *value = tp->Strings[n];
|
||||
if (name != 0
|
||||
&& *name == 'k'
|
||||
|
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* Copyright (c) 1998-2004,2009 Free Software Foundation, Inc. *
|
||||
* Copyright (c) 1998-2009,2010 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 *
|
||||
@ -48,7 +48,7 @@
|
||||
|
||||
#include <curses.priv.h>
|
||||
|
||||
MODULE_ID("$Id: lib_kernel.c,v 1.28 2009/10/24 22:15:47 tom Exp $")
|
||||
MODULE_ID("$Id: lib_kernel.c,v 1.29 2010/01/16 16:33:38 tom Exp $")
|
||||
|
||||
static int
|
||||
_nc_vdisable(void)
|
||||
@ -95,7 +95,7 @@ NCURSES_SP_NAME(erasechar) (NCURSES_SP_DCL0)
|
||||
result = termp->Ottyb.sg_erase;
|
||||
#endif
|
||||
}
|
||||
returnCode(result);
|
||||
returnChar(result);
|
||||
}
|
||||
|
||||
#if NCURSES_SP_FUNCS
|
||||
@ -130,7 +130,7 @@ NCURSES_SP_NAME(killchar) (NCURSES_SP_DCL0)
|
||||
result = termp->Ottyb.sg_kill;
|
||||
#endif
|
||||
}
|
||||
returnCode(result);
|
||||
returnChar(result);
|
||||
}
|
||||
|
||||
#if NCURSES_SP_FUNCS
|
||||
|
@ -42,7 +42,7 @@
|
||||
#include <ctype.h>
|
||||
#include <tic.h>
|
||||
|
||||
MODULE_ID("$Id: lib_tparm.c,v 1.78 2010/01/09 19:52:08 tom Exp $")
|
||||
MODULE_ID("$Id: lib_tparm.c,v 1.79 2010/01/16 16:47:46 tom Exp $")
|
||||
|
||||
/*
|
||||
* char *
|
||||
@ -139,7 +139,7 @@ save_text(const char *fmt, const char *s, int len)
|
||||
{
|
||||
size_t s_len = strlen(s);
|
||||
if (len > (int) s_len)
|
||||
s_len = len;
|
||||
s_len = (size_t) len;
|
||||
|
||||
get_space(s_len + 1);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* Copyright (c) 2008,2009 Free Software Foundation, Inc. *
|
||||
* Copyright (c) 2008-2009,2010 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 *
|
||||
@ -50,7 +50,7 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
MODULE_ID("$Id: tinfo_driver.c,v 1.5 2009/10/31 20:32:01 tom Exp $")
|
||||
MODULE_ID("$Id: tinfo_driver.c,v 1.7 2010/01/16 16:56:16 tom Exp $")
|
||||
|
||||
/*
|
||||
* SCO defines TIOCGSIZE and the corresponding struct. Other systems (SunOS,
|
||||
@ -91,84 +91,6 @@ NCURSES_EXPORT_VAR(int) COLOR_PAIRS = 0;
|
||||
NCURSES_EXPORT_VAR(int) COLORS = 0;
|
||||
#endif
|
||||
|
||||
static bool drv_CanHandle(TERMINAL_CONTROL_BLOCK * TCB, const char *tname, int *);
|
||||
static void drv_init(TERMINAL_CONTROL_BLOCK *);
|
||||
static void drv_release(TERMINAL_CONTROL_BLOCK *);
|
||||
static int drv_size(TERMINAL_CONTROL_BLOCK *, int *, int *);
|
||||
static int drv_sgmode(TERMINAL_CONTROL_BLOCK * TCB, bool setFlag, TTY * buf);
|
||||
static chtype drv_conattr(TERMINAL_CONTROL_BLOCK * TCB);
|
||||
static int drv_mvcur(TERMINAL_CONTROL_BLOCK * TCB, int yold, int xold, int
|
||||
ynew, int xnew);
|
||||
static int drv_mode(TERMINAL_CONTROL_BLOCK * TCB, bool progFlag, bool defFlag);
|
||||
static bool drv_rescol(TERMINAL_CONTROL_BLOCK * TCB);
|
||||
static bool drv_rescolors(TERMINAL_CONTROL_BLOCK * TCB);
|
||||
static void drv_setcolor(TERMINAL_CONTROL_BLOCK * TCB, bool fore, int color, int
|
||||
(*outc) (SCREEN *, int));
|
||||
static int drv_dobeepflash(TERMINAL_CONTROL_BLOCK * TCB, bool beepFlag);
|
||||
static void drv_initpair(TERMINAL_CONTROL_BLOCK * TCB, short pair, short f, short b);
|
||||
static void drv_initcolor(TERMINAL_CONTROL_BLOCK * TCB, short color, short
|
||||
r, short g, short b);
|
||||
static void drv_do_color(TERMINAL_CONTROL_BLOCK * TCB, short old_pair, short
|
||||
pair, bool reverse,
|
||||
int (*outc) (SCREEN *, int));
|
||||
static void drv_initmouse(TERMINAL_CONTROL_BLOCK * TCB);
|
||||
static void drv_setfilter(TERMINAL_CONTROL_BLOCK * TCB);
|
||||
static void drv_hwlabel(TERMINAL_CONTROL_BLOCK * TCB, int labnum, char *text);
|
||||
static void drv_hwlabelOnOff(TERMINAL_CONTROL_BLOCK * TCB, bool OnFlag);
|
||||
static int drv_doupdate(TERMINAL_CONTROL_BLOCK * TCB);
|
||||
static int drv_defaultcolors(TERMINAL_CONTROL_BLOCK * TCB, int fg, int bg);
|
||||
static int drv_print(TERMINAL_CONTROL_BLOCK * TCB, char *data, int len);
|
||||
static int drv_getsize(TERMINAL_CONTROL_BLOCK *, int *, int *);
|
||||
static int drv_setsize(TERMINAL_CONTROL_BLOCK * TCB, int l, int c);
|
||||
static void drv_initacs(TERMINAL_CONTROL_BLOCK * TCB, chtype *, chtype *);
|
||||
static void drv_wrap(SCREEN *);
|
||||
static void drv_screen_init(SCREEN *);
|
||||
static int drv_twait(TERMINAL_CONTROL_BLOCK *, int, int, int
|
||||
*EVENTLIST_2nd(_nc_eventlist
|
||||
*));
|
||||
static int drv_read(TERMINAL_CONTROL_BLOCK * TCB, int *buf);
|
||||
static int drv_nap(TERMINAL_CONTROL_BLOCK * TCB GCC_UNUSED, int ms);
|
||||
static int drv_kpad(TERMINAL_CONTROL_BLOCK * TCB, bool);
|
||||
static int drv_keyok(TERMINAL_CONTROL_BLOCK * TCB, int, bool);
|
||||
static bool drv_kyExist(TERMINAL_CONTROL_BLOCK * TCB, int);
|
||||
|
||||
NCURSES_EXPORT_VAR (TERM_DRIVER) _nc_TINFO_DRIVER = {
|
||||
TRUE,
|
||||
drv_CanHandle, /* CanHandle */
|
||||
drv_init, /* init */
|
||||
drv_release, /* release */
|
||||
drv_size, /* size */
|
||||
drv_sgmode, /* sgmode */
|
||||
drv_conattr, /* conattr */
|
||||
drv_mvcur, /* hwcur */
|
||||
drv_mode, /* mode */
|
||||
drv_rescol, /* rescol */
|
||||
drv_rescolors, /* rescolors */
|
||||
drv_setcolor, /* color */
|
||||
drv_dobeepflash, /* doBeepOrFlash */
|
||||
drv_initpair, /* initpair */
|
||||
drv_initcolor, /* initcolor */
|
||||
drv_do_color, /* docolor */
|
||||
drv_initmouse, /* initmouse */
|
||||
drv_setfilter, /* setfilter */
|
||||
drv_hwlabel, /* hwlabel */
|
||||
drv_hwlabelOnOff, /* hwlabelOnOff */
|
||||
drv_doupdate, /* update */
|
||||
drv_defaultcolors, /* defaultcolors */
|
||||
drv_print, /* print */
|
||||
drv_getsize, /* getsize */
|
||||
drv_setsize, /* setsize */
|
||||
drv_initacs, /* initacs */
|
||||
drv_screen_init, /* scinit */
|
||||
drv_wrap, /* scexit */
|
||||
drv_twait, /* twait */
|
||||
drv_read, /* read */
|
||||
drv_nap, /* nap */
|
||||
drv_kpad, /* kpad */
|
||||
drv_keyok, /* kyOk */
|
||||
drv_kyExist /* kyExist */
|
||||
};
|
||||
|
||||
#define TCBMAGIC NCDRV_MAGIC(NCDRV_TINFO)
|
||||
#define AssertTCB() assert(TCB!=0 && TCB->magic==TCBMAGIC)
|
||||
#define SetSP() assert(TCB->csp!=0); sp = TCB->csp
|
||||
@ -386,8 +308,10 @@ drv_defaultcolors(TERMINAL_CONTROL_BLOCK * TCB, int fg, int bg)
|
||||
}
|
||||
|
||||
static void
|
||||
drv_setcolor(TERMINAL_CONTROL_BLOCK * TCB, bool fore, int color, int (*outc)
|
||||
(SCREEN *, int))
|
||||
drv_setcolor(TERMINAL_CONTROL_BLOCK * TCB,
|
||||
bool fore,
|
||||
int color,
|
||||
NCURSES_SP_OUTC outc)
|
||||
{
|
||||
SCREEN *sp;
|
||||
|
||||
@ -566,11 +490,45 @@ static int
|
||||
drv_setsize(TERMINAL_CONTROL_BLOCK * TCB, int l, int c)
|
||||
{
|
||||
AssertTCB();
|
||||
lines = l;
|
||||
columns = c;
|
||||
lines = (short) l;
|
||||
columns = (short) c;
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int
|
||||
drv_sgmode(TERMINAL_CONTROL_BLOCK * TCB, bool setFlag, TTY * buf)
|
||||
{
|
||||
SCREEN *sp = TCB->csp;
|
||||
TERMINAL *_term = (TERMINAL *) TCB;
|
||||
int result = OK;
|
||||
|
||||
AssertTCB();
|
||||
if (setFlag) {
|
||||
for (;;) {
|
||||
if (SET_TTY(_term->Filedes, buf) != 0) {
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
if (errno == ENOTTY) {
|
||||
if (sp)
|
||||
sp->_notty = TRUE;
|
||||
}
|
||||
result = ERR;
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
for (;;) {
|
||||
if (GET_TTY(_term->Filedes, buf) != 0) {
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
result = ERR;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static int
|
||||
drv_mode(TERMINAL_CONTROL_BLOCK * TCB, bool progFlag, bool defFlag)
|
||||
{
|
||||
@ -653,7 +611,7 @@ drv_release(TERMINAL_CONTROL_BLOCK * TCB GCC_UNUSED)
|
||||
|
||||
# define SGR0_TEST(mode) (mode != 0) && (exit_attribute_mode == 0 || strcmp(mode, exit_attribute_mode))
|
||||
|
||||
void
|
||||
static void
|
||||
drv_screen_init(SCREEN *sp)
|
||||
{
|
||||
TERMINAL_CONTROL_BLOCK *TCB = TCBOf(sp);
|
||||
@ -865,9 +823,9 @@ drv_do_color(TERMINAL_CONTROL_BLOCK * TCB,
|
||||
|
||||
#if NCURSES_EXT_FUNCS
|
||||
if (isDefaultColor(fg))
|
||||
fg = default_fg(sp);
|
||||
fg = (NCURSES_COLOR_T) default_fg(sp);
|
||||
if (isDefaultColor(bg))
|
||||
bg = default_bg(sp);
|
||||
bg = (NCURSES_COLOR_T) default_bg(sp);
|
||||
#endif
|
||||
|
||||
if (reverse) {
|
||||
@ -1006,40 +964,6 @@ drv_setfilter(TERMINAL_CONTROL_BLOCK * TCB)
|
||||
cursor_home = carriage_return;
|
||||
}
|
||||
|
||||
static int
|
||||
drv_sgmode(TERMINAL_CONTROL_BLOCK * TCB, bool setFlag, TTY * buf)
|
||||
{
|
||||
SCREEN *sp = TCB->csp;
|
||||
TERMINAL *_term = (TERMINAL *) TCB;
|
||||
int result = OK;
|
||||
|
||||
AssertTCB();
|
||||
if (setFlag) {
|
||||
for (;;) {
|
||||
if (SET_TTY(_term->Filedes, buf) != 0) {
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
if (errno == ENOTTY) {
|
||||
if (sp)
|
||||
sp->_notty = TRUE;
|
||||
}
|
||||
result = ERR;
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
for (;;) {
|
||||
if (GET_TTY(_term->Filedes, buf) != 0) {
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
result = ERR;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static void
|
||||
drv_initacs(TERMINAL_CONTROL_BLOCK * TCB, chtype *real_map, chtype *fake_map)
|
||||
{
|
||||
@ -1366,3 +1290,40 @@ drv_kyExist(TERMINAL_CONTROL_BLOCK * TCB, int key)
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
NCURSES_EXPORT_VAR (TERM_DRIVER) _nc_TINFO_DRIVER = {
|
||||
TRUE,
|
||||
drv_CanHandle, /* CanHandle */
|
||||
drv_init, /* init */
|
||||
drv_release, /* release */
|
||||
drv_size, /* size */
|
||||
drv_sgmode, /* sgmode */
|
||||
drv_conattr, /* conattr */
|
||||
drv_mvcur, /* hwcur */
|
||||
drv_mode, /* mode */
|
||||
drv_rescol, /* rescol */
|
||||
drv_rescolors, /* rescolors */
|
||||
drv_setcolor, /* color */
|
||||
drv_dobeepflash, /* doBeepOrFlash */
|
||||
drv_initpair, /* initpair */
|
||||
drv_initcolor, /* initcolor */
|
||||
drv_do_color, /* docolor */
|
||||
drv_initmouse, /* initmouse */
|
||||
drv_setfilter, /* setfilter */
|
||||
drv_hwlabel, /* hwlabel */
|
||||
drv_hwlabelOnOff, /* hwlabelOnOff */
|
||||
drv_doupdate, /* update */
|
||||
drv_defaultcolors, /* defaultcolors */
|
||||
drv_print, /* print */
|
||||
drv_getsize, /* getsize */
|
||||
drv_setsize, /* setsize */
|
||||
drv_initacs, /* initacs */
|
||||
drv_screen_init, /* scinit */
|
||||
drv_wrap, /* scexit */
|
||||
drv_twait, /* twait */
|
||||
drv_read, /* read */
|
||||
drv_nap, /* nap */
|
||||
drv_kpad, /* kpad */
|
||||
drv_keyok, /* kyOk */
|
||||
drv_kyExist /* kyExist */
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* Copyright (c) 2005-2006,2007 Free Software Foundation, Inc. *
|
||||
* Copyright (c) 2005-2007,2010 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 *
|
||||
@ -37,7 +37,7 @@
|
||||
#include <tic.h>
|
||||
#include <term_entry.h>
|
||||
|
||||
MODULE_ID("$Id: trim_sgr0.c,v 1.8 2007/04/07 17:14:11 tom Exp $")
|
||||
MODULE_ID("$Id: trim_sgr0.c,v 1.9 2010/01/16 16:45:13 tom Exp $")
|
||||
|
||||
#undef CUR
|
||||
#define CUR tp->
|
||||
@ -170,13 +170,13 @@ chop_out(char *string, unsigned i, unsigned j)
|
||||
* Returns the number of chars from 'full' that we matched. If any mismatch
|
||||
* occurs, return zero.
|
||||
*/
|
||||
static int
|
||||
static unsigned
|
||||
compare_part(const char *part, const char *full)
|
||||
{
|
||||
const char *next_part;
|
||||
const char *next_full;
|
||||
int used_full = 0;
|
||||
int used_delay = 0;
|
||||
unsigned used_full = 0;
|
||||
unsigned used_delay = 0;
|
||||
|
||||
while (*part != 0) {
|
||||
if (*part != *full) {
|
||||
@ -199,7 +199,7 @@ compare_part(const char *part, const char *full)
|
||||
next_part = skip_delay(part);
|
||||
next_full = skip_delay(full);
|
||||
if (next_part != part && next_full != full) {
|
||||
used_delay += (next_full - full);
|
||||
used_delay += (unsigned) (next_full - full);
|
||||
full = next_full;
|
||||
part = next_part;
|
||||
continue;
|
||||
@ -261,7 +261,8 @@ _nc_trim_sgr0(TERMTYPE *tp)
|
||||
k = strlen(exit_alt_charset_mode);
|
||||
if (j > k) {
|
||||
for (i = 0; i <= (j - k); ++i) {
|
||||
int k2 = compare_part(exit_alt_charset_mode, off + i);
|
||||
unsigned k2 = compare_part(exit_alt_charset_mode,
|
||||
off + i);
|
||||
if (k2 != 0) {
|
||||
found = TRUE;
|
||||
chop_out(off, i, i + k2);
|
||||
@ -274,17 +275,17 @@ _nc_trim_sgr0(TERMTYPE *tp)
|
||||
* SGR 10 would reset to normal font.
|
||||
*/
|
||||
if (!found) {
|
||||
if ((i = is_csi(off)) != 0
|
||||
if ((i = (size_t) is_csi(off)) != 0
|
||||
&& off[strlen(off) - 1] == 'm') {
|
||||
TR(TRACE_DATABASE, ("looking for SGR 10 in %s",
|
||||
_nc_visbuf(off)));
|
||||
tmp = skip_zero(off + i);
|
||||
if (tmp[0] == '1'
|
||||
&& skip_zero(tmp + 1) != tmp + 1) {
|
||||
i = tmp - off;
|
||||
i = (size_t) (tmp - off);
|
||||
if (off[i - 1] == ';')
|
||||
i--;
|
||||
j = skip_zero(tmp + 1) - off;
|
||||
j = (size_t) (skip_zero(tmp + 1) - off);
|
||||
i = chop_out(off, i, j);
|
||||
found = TRUE;
|
||||
}
|
||||
@ -293,7 +294,7 @@ _nc_trim_sgr0(TERMTYPE *tp)
|
||||
if (!found
|
||||
&& (tmp = strstr(end, off)) != 0
|
||||
&& strcmp(end, off) != 0) {
|
||||
i = tmp - end;
|
||||
i = (size_t) (tmp - end);
|
||||
j = strlen(off);
|
||||
tmp = strdup(end);
|
||||
chop_out(tmp, i, j);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. *
|
||||
* Copyright (c) 1998-2009,2010 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 *
|
||||
@ -47,7 +47,7 @@
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
MODULE_ID("$Id: lib_trace.c,v 1.73 2009/10/24 21:56:58 tom Exp $")
|
||||
MODULE_ID("$Id: lib_trace.c,v 1.74 2010/01/16 16:31:38 tom Exp $")
|
||||
|
||||
NCURSES_EXPORT_VAR(unsigned) _nc_tracing = 0; /* always define this */
|
||||
|
||||
@ -220,6 +220,14 @@ _nc_retrace_bool(NCURSES_BOOL code)
|
||||
return code;
|
||||
}
|
||||
|
||||
/* Trace 'char' return-values */
|
||||
NCURSES_EXPORT(char)
|
||||
_nc_retrace_char(char code)
|
||||
{
|
||||
T((T_RETURN("%c"), code));
|
||||
return code;
|
||||
}
|
||||
|
||||
/* Trace 'int' return-values */
|
||||
NCURSES_EXPORT(int)
|
||||
_nc_retrace_int(int code)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* Copyright (c) 2008 Free Software Foundation, Inc. *
|
||||
* Copyright (c) 2008,2010 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 *
|
||||
@ -32,12 +32,12 @@
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
MODULE_ID("$Id: gettimeofday.c,v 1.1 2008/12/07 02:07:39 juergen Exp $")
|
||||
MODULE_ID("$Id: gettimeofday.c,v 1.2 2010/01/16 15:18:51 tom Exp $")
|
||||
|
||||
#define JAN1970 116444736000000000LL /* the value for 01/01/1970 00:00 */
|
||||
|
||||
int
|
||||
gettimeofday(struct timeval *tv, void *tz)
|
||||
gettimeofday(struct timeval *tv, void *tz GCC_UNUSED)
|
||||
{
|
||||
union {
|
||||
FILETIME ft;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. *
|
||||
* Copyright (c) 1998-2009,2010 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,108 +33,7 @@
|
||||
|
||||
#include <curses.priv.h>
|
||||
|
||||
MODULE_ID("$Id: win_driver.c,v 1.3 2009/11/07 16:06:42 tom Exp $")
|
||||
|
||||
static bool drv_CanHandle(TERMINAL_CONTROL_BLOCK * TCB, const char *tname, int *);
|
||||
static void drv_init(TERMINAL_CONTROL_BLOCK *);
|
||||
static void drv_release(TERMINAL_CONTROL_BLOCK *);
|
||||
static int drv_size(TERMINAL_CONTROL_BLOCK *, int *, int *);
|
||||
static int drv_sgmode(TERMINAL_CONTROL_BLOCK * TCB,
|
||||
bool setFlag,
|
||||
TTY * buf);
|
||||
static chtype drv_conattr(TERMINAL_CONTROL_BLOCK * TCB);
|
||||
|
||||
static int drv_mvcur(TERMINAL_CONTROL_BLOCK * TCB,
|
||||
int yold, int xold, int ynew, int xnew);
|
||||
static int drv_mode(TERMINAL_CONTROL_BLOCK * TCB,
|
||||
bool progFlag, bool defFlag);
|
||||
static bool drv_rescol(TERMINAL_CONTROL_BLOCK * TCB);
|
||||
static bool drv_rescolors(TERMINAL_CONTROL_BLOCK * TCB);
|
||||
static void drv_setcolor(TERMINAL_CONTROL_BLOCK * TCB,
|
||||
bool fore,
|
||||
int color,
|
||||
int (*outc) (SCREEN *, int));
|
||||
static int drv_dobeepflash(TERMINAL_CONTROL_BLOCK * TCB, bool);
|
||||
static void drv_initpair(TERMINAL_CONTROL_BLOCK * TCB,
|
||||
short pair,
|
||||
short f,
|
||||
short b);
|
||||
static void drv_initcolor(TERMINAL_CONTROL_BLOCK * TCB,
|
||||
short color,
|
||||
short r,
|
||||
short g,
|
||||
short b);
|
||||
static void drv_do_color(TERMINAL_CONTROL_BLOCK * TCB,
|
||||
short old_pair,
|
||||
short pair,
|
||||
bool reverse,
|
||||
int (*outc) (SCREEN *, int));
|
||||
static void drv_initmouse(TERMINAL_CONTROL_BLOCK * TCB);
|
||||
static void drv_setfilter(TERMINAL_CONTROL_BLOCK * TCB);
|
||||
static void drv_hwlabel(TERMINAL_CONTROL_BLOCK * TCB,
|
||||
int labnum,
|
||||
char *text);
|
||||
static void drv_hwlabelOnOff(TERMINAL_CONTROL_BLOCK * TCB,
|
||||
bool OnFlag);
|
||||
static int drv_doupdate(TERMINAL_CONTROL_BLOCK * TCB);
|
||||
|
||||
static int drv_defaultcolors(TERMINAL_CONTROL_BLOCK * TCB,
|
||||
int fg,
|
||||
int bg);
|
||||
static int drv_print(TERMINAL_CONTROL_BLOCK * TCB,
|
||||
char *data,
|
||||
int len);
|
||||
/*static int _getsize(TERMINAL_CONTROL_BLOCK*,int *, int *);*/
|
||||
static int drv_setsize(TERMINAL_CONTROL_BLOCK * TCB, int l, int c);
|
||||
static void drv_initacs(TERMINAL_CONTROL_BLOCK * TCB, chtype *, chtype *);
|
||||
static void drv_wrap(SCREEN *);
|
||||
static void drv_screen_init(SCREEN *);
|
||||
static int drv_twait(TERMINAL_CONTROL_BLOCK *,
|
||||
int,
|
||||
int,
|
||||
int *EVENTLIST_2nd(_nc_eventlist *));
|
||||
static int drv_read(TERMINAL_CONTROL_BLOCK * TCB, int *buf);
|
||||
static int drv_nap(TERMINAL_CONTROL_BLOCK * TCB GCC_UNUSED, int ms);
|
||||
static int drv_kpad(TERMINAL_CONTROL_BLOCK * TCB, bool);
|
||||
static int drv_keyok(TERMINAL_CONTROL_BLOCK * TCB, int, bool);
|
||||
static bool drv_kyExist(TERMINAL_CONTROL_BLOCK * TCB, int);
|
||||
|
||||
NCURSES_EXPORT_VAR (TERM_DRIVER) _nc_WIN_DRIVER = {
|
||||
FALSE,
|
||||
drv_CanHandle, /* CanHandle */
|
||||
drv_init, /* init */
|
||||
drv_release, /* release */
|
||||
drv_size, /* size */
|
||||
drv_sgmode, /* sgmode */
|
||||
drv_conattr, /* conattr */
|
||||
drv_mvcur, /* hwcur */
|
||||
drv_mode, /* mode */
|
||||
drv_rescol, /* rescol */
|
||||
drv_rescolors, /* rescolors */
|
||||
drv_setcolor, /* color */
|
||||
drv_dobeepflash, /* DoBeepFlash */
|
||||
drv_initpair, /* initpair */
|
||||
drv_initcolor, /* initcolor */
|
||||
drv_do_color, /* docolor */
|
||||
drv_initmouse, /* initmouse */
|
||||
drv_setfilter, /* setfilter */
|
||||
drv_hwlabel, /* hwlabel */
|
||||
drv_hwlabelOnOff, /* hwlabelOnOff */
|
||||
drv_doupdate, /* update */
|
||||
drv_defaultcolors, /* defaultcolors */
|
||||
drv_print, /* print */
|
||||
drv_size, /* getsize */
|
||||
drv_setsize, /* setsize */
|
||||
drv_initacs, /* initacs */
|
||||
drv_screen_init, /* scinit */
|
||||
drv_wrap, /* scexit */
|
||||
drv_twait, /* twait */
|
||||
drv_read, /* read */
|
||||
drv_nap, /* nap */
|
||||
drv_kpad, /* kpad */
|
||||
drv_keyok, /* kyOk */
|
||||
drv_kyExist /* kyExist */
|
||||
};
|
||||
MODULE_ID("$Id: win_driver.c,v 1.5 2010/01/16 22:42:30 tom Exp $")
|
||||
|
||||
#define WINMAGIC NCDRV_MAGIC(NCDRV_WINCONSOLE)
|
||||
|
||||
@ -356,13 +255,22 @@ drv_CanHandle(TERMINAL_CONTROL_BLOCK * TCB,
|
||||
const char *tname,
|
||||
int *errret GCC_UNUSED)
|
||||
{
|
||||
bool code = FALSE;
|
||||
|
||||
T((T_CALLED("drv_CanHandle(%p)"), TCB));
|
||||
|
||||
assert(TCB != 0);
|
||||
assert(tname != 0);
|
||||
|
||||
TCB->magic = WINMAGIC;
|
||||
if (*tname == 0 || *tname == 0 || strcmp(tname, "unknown") == 0) {
|
||||
return TRUE;
|
||||
} else
|
||||
return FALSE;
|
||||
code = TRUE;
|
||||
if ((TCB->term.type.Booleans) == 0) {
|
||||
_nc_init_entry(&(TCB->term.type));
|
||||
}
|
||||
}
|
||||
|
||||
returnBool(code);
|
||||
}
|
||||
|
||||
static int
|
||||
@ -470,6 +378,74 @@ drv_setsize(TERMINAL_CONTROL_BLOCK * TCB GCC_UNUSED,
|
||||
return ERR;
|
||||
}
|
||||
|
||||
static int
|
||||
drv_sgmode(TERMINAL_CONTROL_BLOCK * TCB, bool setFlag, TTY * buf)
|
||||
{
|
||||
DWORD dwFlag = 0;
|
||||
tcflag_t iflag;
|
||||
tcflag_t lflag;
|
||||
|
||||
AssertTCB();
|
||||
|
||||
if (TCB == 0 || buf == NULL)
|
||||
return ERR;
|
||||
|
||||
if (setFlag) {
|
||||
iflag = buf->c_iflag;
|
||||
lflag = buf->c_lflag;
|
||||
|
||||
GetConsoleMode(TCB->inp, &dwFlag);
|
||||
|
||||
if (lflag & ICANON)
|
||||
dwFlag |= ENABLE_LINE_INPUT;
|
||||
else
|
||||
dwFlag &= ~ENABLE_LINE_INPUT;
|
||||
|
||||
if (lflag & ECHO)
|
||||
dwFlag |= ENABLE_ECHO_INPUT;
|
||||
else
|
||||
dwFlag &= ~ENABLE_ECHO_INPUT;
|
||||
|
||||
if (iflag & BRKINT)
|
||||
dwFlag |= ENABLE_PROCESSED_INPUT;
|
||||
else
|
||||
dwFlag &= ~ENABLE_PROCESSED_INPUT;
|
||||
|
||||
/* we disable that for now to focus on keyboard. */
|
||||
dwFlag &= ~ENABLE_MOUSE_INPUT;
|
||||
|
||||
buf->c_iflag = iflag;
|
||||
buf->c_lflag = lflag;
|
||||
SetConsoleMode(TCB->inp, dwFlag);
|
||||
TCB->term.Nttyb = *buf;
|
||||
} else {
|
||||
iflag = TCB->term.Nttyb.c_iflag;
|
||||
lflag = TCB->term.Nttyb.c_lflag;
|
||||
GetConsoleMode(TCB->inp, &dwFlag);
|
||||
|
||||
if (dwFlag & ENABLE_LINE_INPUT)
|
||||
lflag |= ICANON;
|
||||
else
|
||||
lflag &= ~ICANON;
|
||||
|
||||
if (dwFlag & ENABLE_ECHO_INPUT)
|
||||
lflag |= ECHO;
|
||||
else
|
||||
lflag &= ~ECHO;
|
||||
|
||||
if (dwFlag & ENABLE_PROCESSED_INPUT)
|
||||
iflag |= BRKINT;
|
||||
else
|
||||
iflag &= ~BRKINT;
|
||||
|
||||
TCB->term.Nttyb.c_iflag = iflag;
|
||||
TCB->term.Nttyb.c_lflag = lflag;
|
||||
|
||||
*buf = TCB->term.Nttyb;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int
|
||||
drv_mode(TERMINAL_CONTROL_BLOCK * TCB, bool progFlag, bool defFlag)
|
||||
{
|
||||
@ -576,14 +552,20 @@ MapKey(TERMINAL_CONTROL_BLOCK * TCB, WORD vKey)
|
||||
static void
|
||||
drv_release(TERMINAL_CONTROL_BLOCK * TCB)
|
||||
{
|
||||
T((T_CALLED("drv_release(%p)"), TCB));
|
||||
|
||||
AssertTCB();
|
||||
if (TCB->prop)
|
||||
free(TCB->prop);
|
||||
|
||||
returnVoid;
|
||||
}
|
||||
|
||||
static void
|
||||
drv_init(TERMINAL_CONTROL_BLOCK * TCB)
|
||||
{
|
||||
T((T_CALLED("drv_init(%p)"), TCB));
|
||||
|
||||
AssertTCB();
|
||||
|
||||
if (TCB) {
|
||||
@ -646,6 +628,7 @@ drv_init(TERMINAL_CONTROL_BLOCK * TCB)
|
||||
for (i = 0; i < NUMPAIRS; i++)
|
||||
PropOf(TCB)->pairs[i] = a;
|
||||
}
|
||||
returnVoid;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -755,82 +738,51 @@ drv_setfilter(TERMINAL_CONTROL_BLOCK * TCB)
|
||||
SetSP();
|
||||
}
|
||||
|
||||
static int
|
||||
drv_sgmode(TERMINAL_CONTROL_BLOCK * TCB, bool setFlag, TTY * buf)
|
||||
{
|
||||
DWORD dwFlag = 0;
|
||||
tcflag_t iflag;
|
||||
tcflag_t lflag;
|
||||
|
||||
AssertTCB();
|
||||
|
||||
if (TCB == 0 || buf == NULL)
|
||||
return ERR;
|
||||
|
||||
if (setFlag) {
|
||||
iflag = buf->c_iflag;
|
||||
lflag = buf->c_lflag;
|
||||
|
||||
GetConsoleMode(TCB->inp, &dwFlag);
|
||||
|
||||
if (lflag & ICANON)
|
||||
dwFlag |= ENABLE_LINE_INPUT;
|
||||
else
|
||||
dwFlag &= ~ENABLE_LINE_INPUT;
|
||||
|
||||
if (lflag & ECHO)
|
||||
dwFlag |= ENABLE_ECHO_INPUT;
|
||||
else
|
||||
dwFlag &= ~ENABLE_ECHO_INPUT;
|
||||
|
||||
if (iflag & BRKINT)
|
||||
dwFlag |= ENABLE_PROCESSED_INPUT;
|
||||
else
|
||||
dwFlag &= ~ENABLE_PROCESSED_INPUT;
|
||||
|
||||
/* we disable that for now to focus on keyboard. */
|
||||
dwFlag &= ~ENABLE_MOUSE_INPUT;
|
||||
|
||||
buf->c_iflag = iflag;
|
||||
buf->c_lflag = lflag;
|
||||
SetConsoleMode(TCB->inp, dwFlag);
|
||||
TCB->term.Nttyb = *buf;
|
||||
} else {
|
||||
iflag = TCB->term.Nttyb.c_iflag;
|
||||
lflag = TCB->term.Nttyb.c_lflag;
|
||||
GetConsoleMode(TCB->inp, &dwFlag);
|
||||
|
||||
if (dwFlag & ENABLE_LINE_INPUT)
|
||||
lflag |= ICANON;
|
||||
else
|
||||
lflag &= ~ICANON;
|
||||
|
||||
if (dwFlag & ENABLE_ECHO_INPUT)
|
||||
lflag |= ECHO;
|
||||
else
|
||||
lflag &= ~ECHO;
|
||||
|
||||
if (dwFlag & ENABLE_PROCESSED_INPUT)
|
||||
iflag |= BRKINT;
|
||||
else
|
||||
iflag &= ~BRKINT;
|
||||
|
||||
TCB->term.Nttyb.c_iflag = iflag;
|
||||
TCB->term.Nttyb.c_lflag = lflag;
|
||||
|
||||
*buf = TCB->term.Nttyb;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
static void
|
||||
drv_initacs(TERMINAL_CONTROL_BLOCK * TCB,
|
||||
chtype *real_map GCC_UNUSED,
|
||||
chtype *fake_map GCC_UNUSED)
|
||||
{
|
||||
#define DATA(a,b) { a, b }
|
||||
static struct {
|
||||
int acs_code;
|
||||
int use_code;
|
||||
} table[] = {
|
||||
DATA('a', 0xb1), /* ACS_CKBOARD */
|
||||
DATA('f', 0xf8), /* ACS_DEGREE */
|
||||
DATA('g', 0xf1), /* ACS_PLMINUS */
|
||||
DATA('j', 0xd9), /* ACS_LRCORNER */
|
||||
DATA('l', 0xda), /* ACS_ULCORNER */
|
||||
DATA('k', 0xbf), /* ACS_URCORNER */
|
||||
DATA('m', 0xc0), /* ACS_LLCORNER */
|
||||
DATA('n', 0xc5), /* ACS_PLUS */
|
||||
DATA('q', 0xc4), /* ACS_HLINE */
|
||||
DATA('t', 0xc3), /* ACS_LTEE */
|
||||
DATA('u', 0xb4), /* ACS_RTEE */
|
||||
DATA('v', 0xc1), /* ACS_BTEE */
|
||||
DATA('w', 0xc2), /* ACS_TTEE */
|
||||
DATA('x', 0xb3), /* ACS_VLINE */
|
||||
DATA('y', 0xf3), /* ACS_LEQUAL */
|
||||
DATA('z', 0xf2), /* ACS_GEQUAL */
|
||||
DATA('0', 0xdb), /* ACS_BLOCK */
|
||||
DATA('{', 0xe3), /* ACS_PI */
|
||||
DATA('}', 0x9c), /* ACS_STERLING */
|
||||
DATA(',', 0xae), /* ACS_LARROW */
|
||||
DATA('+', 0xaf), /* ACS_RARROW */
|
||||
DATA('~', 0xf9), /* ACS_BULLET */
|
||||
};
|
||||
#undef DATA
|
||||
unsigned n;
|
||||
|
||||
SCREEN *sp;
|
||||
AssertTCB();
|
||||
SetSP();
|
||||
|
||||
for (n = 0; n < SIZEOF(table); ++n) {
|
||||
real_map[table[n].acs_code] = table[n].use_code | A_ALTCHARSET;
|
||||
if (sp != 0)
|
||||
sp->_screen_acs_map[table[n].acs_code] = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
static ULONGLONG
|
||||
@ -1083,3 +1035,40 @@ drv_keyok(TERMINAL_CONTROL_BLOCK * TCB, int keycode, bool flag)
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
NCURSES_EXPORT_VAR (TERM_DRIVER) _nc_WIN_DRIVER = {
|
||||
FALSE,
|
||||
drv_CanHandle, /* CanHandle */
|
||||
drv_init, /* init */
|
||||
drv_release, /* release */
|
||||
drv_size, /* size */
|
||||
drv_sgmode, /* sgmode */
|
||||
drv_conattr, /* conattr */
|
||||
drv_mvcur, /* hwcur */
|
||||
drv_mode, /* mode */
|
||||
drv_rescol, /* rescol */
|
||||
drv_rescolors, /* rescolors */
|
||||
drv_setcolor, /* color */
|
||||
drv_dobeepflash, /* DoBeepFlash */
|
||||
drv_initpair, /* initpair */
|
||||
drv_initcolor, /* initcolor */
|
||||
drv_do_color, /* docolor */
|
||||
drv_initmouse, /* initmouse */
|
||||
drv_setfilter, /* setfilter */
|
||||
drv_hwlabel, /* hwlabel */
|
||||
drv_hwlabelOnOff, /* hwlabelOnOff */
|
||||
drv_doupdate, /* update */
|
||||
drv_defaultcolors, /* defaultcolors */
|
||||
drv_print, /* print */
|
||||
drv_size, /* getsize */
|
||||
drv_setsize, /* setsize */
|
||||
drv_initacs, /* initacs */
|
||||
drv_screen_init, /* scinit */
|
||||
drv_wrap, /* scexit */
|
||||
drv_twait, /* twait */
|
||||
drv_read, /* read */
|
||||
drv_nap, /* nap */
|
||||
drv_kpad, /* kpad */
|
||||
drv_keyok, /* kyOk */
|
||||
drv_kyExist /* kyExist */
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. *
|
||||
* Copyright (c) 1998-2009,2010 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 *
|
||||
@ -119,7 +119,7 @@ char *ttyname(int fd);
|
||||
#include <dump_entry.h>
|
||||
#include <transform.h>
|
||||
|
||||
MODULE_ID("$Id: tset.c,v 1.80 2009/12/12 19:49:03 tom Exp $")
|
||||
MODULE_ID("$Id: tset.c,v 1.81 2010/01/16 15:20:23 tom Exp $")
|
||||
|
||||
/*
|
||||
* SCO defines TIOCGSIZE and the corresponding struct. Other systems (SunOS,
|
||||
@ -141,7 +141,9 @@ MODULE_ID("$Id: tset.c,v 1.80 2009/12/12 19:49:03 tom Exp $")
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef environ
|
||||
extern char **environ;
|
||||
#endif
|
||||
|
||||
#undef CTRL
|
||||
#define CTRL(x) ((x) & 0x1f)
|
||||
|
Loading…
Reference in New Issue
Block a user