/*
Version Control
- $Id: gen.c,v 1.62 2014/01/26 00:21:52 Nicolas.Boulenguez Exp $
+ $Id: gen.c,v 1.64 2014/02/01 19:52:47 tom Exp $
--------------------------------------------------------------------------*/
/*
This program generates various record structures and constants from the
#include <menu.h>
#include <form.h>
-#define UChar(c) ((unsigned char)(c))
+#undef UCHAR
+#undef UINT
+#define UChar(c) ((UCHAR)(c))
#define RES_NAME "Reserved"
+typedef unsigned char UCHAR;
+typedef unsigned int UINT;
+
static const char *model = "";
static int little_endian = 0;
}
name_attribute_pair;
+static UCHAR
+bit_is_set(const UCHAR * const data,
+ const UINT offset)
+{
+ const UCHAR byte = data[offset >> 3];
+ UINT bit;
+
+ if (little_endian)
+ bit = offset; /* offset */
+ else /* or */
+ bit = ~offset; /* 7 - offset */
+ bit &= 7; /* modulo 8 */
+ return byte & (UCHAR) (1 << bit);
+}
+
+/* Find lowest and highest used offset in a byte array. */
+/* Returns 0 if and only if all bits are unset. */
static int
-find_pos(char *s, unsigned len, int *low, int *high)
+find_pos(const UCHAR * const data,
+ const UINT sizeof_data,
+ UINT * const low,
+ UINT * const high)
{
- unsigned int i, j;
- int l = 0;
+ const UINT last = (sizeof_data << 3) - 1;
+ UINT offset;
- *high = -1;
- *low = (int)(8 * len);
+ for (offset = last; !bit_is_set(data, offset); offset--)
+ if (!offset) /* All bits are 0. */
+ return 0;
+ *high = offset;
- for (i = 0; i < len; i++, s++)
+ for (offset = 0; !bit_is_set(data, offset); offset++)
{
- if (*s)
- {
- for (j = 0; j < 8 * sizeof(char); j++)
-
- {
- if (((little_endian && ((*s) & 0x01)) ||
- (!little_endian && ((*s) & 0x80))))
- {
- if (l > *high)
- *high = l;
- if (l < *low)
- *low = l;
- }
- l++;
- if (little_endian)
- {
- *s >>= 1;
- }
- else
- {
- *s = (char)(*s << 1);
- }
- }
- }
- else
- l += 8;
}
- return (*high >= 0 && (*low <= *high)) ? *low : -1;
+ *low = offset;
+
+ return -1;
}
/*
gen_reps(
const name_attribute_pair * nap, /* array of name_attribute_pair records */
const char *name, /* name of the represented record type */
- int len, /* size of the record in bytes */
- int bias)
+ const UINT len, /* size of the record in bytes */
+ const UINT bias)
{
- const int len_bits = (8 * len);
- int i, l, low, high;
+ const UINT len_bits = len << 3;
+ int i, l;
+ UINT low, high;
int width = strlen(RES_NAME) + 3;
- unsigned long a;
assert(nap != NULL);
for (i = 0; nap[i].name != (char *)0; i++)
if (nap[i].attr)
{
- a = nap[i].attr;
- l = find_pos((char *)&a, sizeof(a), &low, &high);
- if (l >= 0)
+ if (find_pos((const UCHAR *)(&(nap[i].attr)) + bias, len, &low, &high))
printf(" %-*s at 0 range %2d .. %2d;\n", width, nap[i].name,
- low - bias, high - bias);
+ low, high);
}
printf(" end record;\n");
printf(" pragma Warnings (Off);");
{
attr_t x = (attr_t)-1;
attr_t t = x & mask;
- int low, high;
- int l = find_pos((char *)&t, sizeof(t), &low, &high);
+ UINT low, high;
- if (l >= 0)
+ if (find_pos((const UCHAR *)(&t), sizeof(t), &low, &high))
printf(" %-5s at 0 range %2d .. %2d;\n", name, low, high);
}
static void
mrep_rep(const char *name, void *rec)
{
- int low, high;
- int l = find_pos((char *)rec, sizeof(MEVENT), &low, &high);
+ UINT low, high;
- if (l >= 0)
+ if (find_pos((const UCHAR *)rec, sizeof(MEVENT), &low, &high))
printf(" %-7s at 0 range %3d .. %3d;\n", name, low, high);
}
}
attr = attr >> 1;
}
- gen_reps(nap, name, (len + 7) / 8, little_endian ? start : 0);
+ gen_reps(nap, name,
+ (UINT) ((len + 7) / 8),
+ (UINT) (little_endian ? start >> 3 : 0));
}
static void
{"Attributes_And_Colors", TRACE_ATTRS},
{(char *)0, 0}
};
- gen_reps(nap, name, sizeof(int), 0);
+
+ gen_reps(nap, name, sizeof(UINT),
+ little_endian ? 0 : sizeof(nap[0].attr) - sizeof(UINT));
}
static void
#endif
{(char *)0, 0}
};
- gen_reps(nap, name, sizeof(int), 0);
+
+ gen_reps(nap, name, sizeof(Menu_Options),
+ little_endian ? 0 : sizeof(nap[0].attr) - sizeof(Menu_Options));
}
static void
#endif
{(char *)0, 0}
};
- gen_reps(nap, name, sizeof(int), 0);
+
+ gen_reps(nap, name, sizeof(Item_Options),
+ little_endian ? 0 : sizeof(nap[0].attr) - sizeof(Item_Options));
}
static void
#endif
{(char *)0, 0}
};
- gen_reps(nap, name, sizeof(int), 0);
+
+ gen_reps(nap, name, sizeof(Form_Options),
+ little_endian ? 0 : sizeof(nap[0].attr) - sizeof(Form_Options));
}
/*
#endif
{(char *)0, 0}
};
- gen_reps(nap, name, sizeof(int), 0);
+
+ gen_reps(nap, name, sizeof(Field_Options),
+ little_endian ? 0 : sizeof(nap[0].attr) - sizeof(Field_Options));
}
/*
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
-------------------------------------------------------------------------------
--- $Id: NEWS,v 1.2157 2014/01/26 00:20:39 tom Exp $
+-- $Id: NEWS,v 1.2161 2014/02/01 22:30:45 tom Exp $
-------------------------------------------------------------------------------
This is a log of changes that ncurses has gone through since Zeyd started
Changes through 1.9.9e did not credit all contributions;
it is not possible to add this information.
+20140201
+ + add/use symbol NCURSES_PAIRS_T like NCURSES_COLOR_T, to illustrate
+ which "short" types are for color pairs and which are color values.
+ + fix build for s390x, by correcting field bit offsets in generated
+ representation clauses when int=32 long=64 and endian=big, or at
+ least on s390x (patch by Nicolas Boulenguez).
+ + minor cleanup change to test/form_driver_w.c (patch by Gaute Hope).
+
20140125
+ remove unnecessary ifdef's in Ada95/gen/gen.c, which reportedly do
not work as is with gcc 4.8 due to fixes using chtype cast made for
// * this is for making emacs happy: -*-Mode: C++;-*-
/****************************************************************************
- * Copyright (c) 2007-2011,2012 Free Software Foundation, Inc. *
+ * Copyright (c) 2007-2012,2014 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
#include "internal.h"
#include "cursesw.h"
-MODULE_ID("$Id: cursesw.cc,v 1.53 2012/12/08 22:06:41 tom Exp $")
+MODULE_ID("$Id: cursesw.cc,v 1.54 2014/02/01 22:10:42 tom Exp $")
#define COLORS_NEED_INITIALIZATION -1
#define COLORS_NOT_INITIALIZED 0
}
}
-short
+NCURSES_PAIRS_T
NCursesWindow::getPair() const
{
- return static_cast<short>(PAIR_NUMBER(getattrs(w)));
+ return static_cast<NCURSES_PAIRS_T>(PAIR_NUMBER(getattrs(w)));
}
-short
+NCURSES_COLOR_T
NCursesWindow::getcolor(int getback) const
{
- short fore, back;
+ NCURSES_COLOR_T fore, back;
if (HaveColors()) {
if (::pair_content(getPair(), &fore, &back) == ERR)
return (HaveColors()) ? COLORS : 1;
}
-short
+NCURSES_PAIRS_T
NCursesWindow::getcolor() const
{
return (HaveColors()) ? getPair() : 0;
}
int
-NCursesWindow::setpalette(short fore, short back, short pair)
+NCursesWindow::setpalette(NCURSES_COLOR_T fore, NCURSES_COLOR_T back, NCURSES_PAIRS_T pair)
{
return (HaveColors()) ? ::init_pair(pair, fore, back) : OK;
}
int
-NCursesWindow::setpalette(short fore, short back)
+NCursesWindow::setpalette(NCURSES_COLOR_T fore, NCURSES_COLOR_T back)
{
return setpalette(fore, back, getPair());
}
int
-NCursesWindow::setcolor(short pair)
+NCursesWindow::setcolor(NCURSES_PAIRS_T pair)
{
if (HaveColors()) {
if ((pair < 1) || (pair > COLOR_PAIRS))
// * This makes emacs happy -*-Mode: C++;-*-
// vile:cppmode
/****************************************************************************
- * Copyright (c) 1998-2008,2011 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2011,2014 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 *
#ifndef NCURSES_CURSESW_H_incl
#define NCURSES_CURSESW_H_incl 1
-// $Id: cursesw.h,v 1.49 2011/09/17 22:12:10 tom Exp $
+// $Id: cursesw.h,v 1.50 2014/02/01 22:17:37 tom Exp $
#include <etip.h>
#endif
#ifdef chgat
-inline int UNDEF(chgat)(int n, attr_t attr, short color, const void *opts) {
+inline int UNDEF(chgat)(int n, attr_t attr, NCURSES_PAIRS_T color, const void *opts) {
return chgat(n, attr, color, opts); }
#undef chgat
#define chgat UNDEF(chgat)
#endif
#ifdef color_set
-inline chtype UNDEF(color_set)(short p, void* opts) { return color_set(p, opts); }
+inline chtype UNDEF(color_set)(NCURSES_PAIRS_T p, void* opts) { return color_set(p, opts); }
#undef color_set
#define color_set UNDEF(color_set)
#endif
#ifdef mvchgat
inline int UNDEF(mvchgat)(int y, int x, int n,
- attr_t attr, short color, const void *opts) {
+ attr_t attr, NCURSES_PAIRS_T color, const void *opts) {
return mvchgat(y, x, n, attr, color, opts); }
#undef mvchgat
#define mvchgat UNDEF(mvchgat)
#ifdef mvwchgat
inline int UNDEF(mvwchgat)(WINDOW *win, int y, int x, int n,
- attr_t attr, short color, const void *opts) {
+ attr_t attr, NCURSES_PAIRS_T color, const void *opts) {
return mvwchgat(win, y, x, n, attr, color, opts); }
#undef mvwchgat
#define mvwchgat UNDEF(mvwchgat)
void set_keyboard();
- short getcolor(int getback) const;
- short getPair() const;
+ NCURSES_COLOR_T getcolor(int getback) const;
+ NCURSES_PAIRS_T getPair() const;
- static int setpalette(short fore, short back, short pair);
+ static int setpalette(NCURSES_COLOR_T fore, NCURSES_COLOR_T back, NCURSES_PAIRS_T pair);
static int colorInitialized;
// This private constructor is only used during the initialization
int maxy() const { return getmaxy(w) == ERR ? ERR : getmaxy(w)-1; }
// Largest y coord in window
- short getcolor() const;
+ NCURSES_PAIRS_T getcolor() const;
// Actual color pair
- short foreground() const { return getcolor(0); }
+ NCURSES_COLOR_T foreground() const { return getcolor(0); }
// Actual foreground color
- short background() const { return getcolor(1); }
+ NCURSES_COLOR_T background() const { return getcolor(1); }
// Actual background color
- int setpalette(short fore, short back);
+ int setpalette(NCURSES_COLOR_T fore, NCURSES_COLOR_T back);
// Set color palette entry
- int setcolor(short pair);
+ int setcolor(NCURSES_PAIRS_T pair);
// Set actually used palette entry
// -------------------------------------------------------------------------
chtype attrget() { return ::getattrs(w); }
// Get the window attributes;
- int color_set(short color_pair_number, void* opts=NULL) {
+ int color_set(NCURSES_PAIRS_T color_pair_number, void* opts=NULL) {
return ::wcolor_set(w, color_pair_number, opts); }
// Set the window color attribute;
- int chgat(int n, attr_t attr, short color, const void *opts=NULL) {
+ int chgat(int n, attr_t attr, NCURSES_PAIRS_T color, const void *opts=NULL) {
return ::wchgat(w, n, attr, color, opts); }
// Change the attributes of the next n characters in the current line. If
// n is negative or greater than the number of remaining characters in the
// line, the attributes will be changed up to the end of the line.
int chgat(int y, int x,
- int n, attr_t attr, short color, const void *opts=NULL) {
+ int n, attr_t attr, NCURSES_PAIRS_T color, const void *opts=NULL) {
return ::mvwchgat(w, y, x, n, attr, color, opts); }
// Move the cursor to the requested position and then perform chgat() as
// described above.
# use or other dealings in this Software without prior written #
# authorization. #
##############################################################################
-# $Id: dist.mk,v 1.968 2014/01/25 16:16:43 tom Exp $
+# $Id: dist.mk,v 1.969 2014/02/01 17:10:27 tom Exp $
# Makefile for creating ncurses distributions.
#
# This only needs to be used directly as a makefile by developers, but
# These define the major/minor/patch versions of ncurses.
NCURSES_MAJOR = 5
NCURSES_MINOR = 9
-NCURSES_PATCH = 20140125
+NCURSES_PATCH = 20140201
# We don't append the patch to the version, since this only applies to releases
VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
/****************************************************************************
- * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2013,2014 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 *
* and: Thomas E. Dickey 1996-on *
****************************************************************************/
-/* $Id: curses.h.in,v 1.236 2013/09/07 19:07:23 tom Exp $ */
+/* $Id: curses.h.in,v 1.237 2014/02/01 22:08:12 tom Exp $ */
#ifndef __NCURSES_H
#define __NCURSES_H
#define NCURSES_INLINE @NCURSES_INLINE@
/*
- * The internal type used for color values
+ * The internal type used for color values, and for color-pairs. The latter
+ * allows the curses library to enumerate the combinations of foreground and
+ * background colors used by an application, and is normally the product of the
+ * total foreground and background colors.
+ *
+ * X/Open uses "short" for both of these types, ultimately because they are
+ * numbers from the terminal database, which uses 16-bit signed values.
*/
#undef NCURSES_COLOR_T
#define NCURSES_COLOR_T short
+#undef NCURSES_PAIRS_T
+#define NCURSES_PAIRS_T short
+
/*
* Definition used to make WINDOW and similar structs opaque.
*/
extern NCURSES_EXPORT(int) attroff (NCURSES_ATTR_T); /* generated */
extern NCURSES_EXPORT(int) attron (NCURSES_ATTR_T); /* generated */
extern NCURSES_EXPORT(int) attrset (NCURSES_ATTR_T); /* generated */
-extern NCURSES_EXPORT(int) attr_get (attr_t *, short *, void *); /* generated */
+extern NCURSES_EXPORT(int) attr_get (attr_t *, NCURSES_PAIRS_T *, void *); /* generated */
extern NCURSES_EXPORT(int) attr_off (attr_t, void *); /* generated */
extern NCURSES_EXPORT(int) attr_on (attr_t, void *); /* generated */
-extern NCURSES_EXPORT(int) attr_set (attr_t, short, void *); /* generated */
+extern NCURSES_EXPORT(int) attr_set (attr_t, NCURSES_PAIRS_T, void *); /* generated */
extern NCURSES_EXPORT(int) baudrate (void); /* implemented */
extern NCURSES_EXPORT(int) beep (void); /* implemented */
extern NCURSES_EXPORT(int) bkgd (chtype); /* generated */
extern NCURSES_EXPORT(int) box (WINDOW *, chtype, chtype); /* generated */
extern NCURSES_EXPORT(bool) can_change_color (void); /* implemented */
extern NCURSES_EXPORT(int) cbreak (void); /* implemented */
-extern NCURSES_EXPORT(int) chgat (int, attr_t, short, const void *); /* generated */
+extern NCURSES_EXPORT(int) chgat (int, attr_t, NCURSES_PAIRS_T, const void *); /* generated */
extern NCURSES_EXPORT(int) clear (void); /* generated */
extern NCURSES_EXPORT(int) clearok (WINDOW *,bool); /* implemented */
extern NCURSES_EXPORT(int) clrtobot (void); /* generated */
extern NCURSES_EXPORT(int) clrtoeol (void); /* generated */
-extern NCURSES_EXPORT(int) color_content (short,short*,short*,short*); /* implemented */
-extern NCURSES_EXPORT(int) color_set (short,void*); /* generated */
+extern NCURSES_EXPORT(int) color_content (NCURSES_COLOR_T,NCURSES_COLOR_T*,NCURSES_COLOR_T*,NCURSES_COLOR_T*); /* implemented */
+extern NCURSES_EXPORT(int) color_set (NCURSES_PAIRS_T,void*); /* generated */
extern NCURSES_EXPORT(int) COLOR_PAIR (int); /* generated */
extern NCURSES_EXPORT(int) copywin (const WINDOW*,WINDOW*,int,int,int,int,int,int,int); /* implemented */
extern NCURSES_EXPORT(int) curs_set (int); /* implemented */
extern NCURSES_EXPORT(int) inchnstr (chtype *, int); /* generated */
extern NCURSES_EXPORT(int) inchstr (chtype *); /* generated */
extern NCURSES_EXPORT(WINDOW *) initscr (void); /* implemented */
-extern NCURSES_EXPORT(int) init_color (short,short,short,short); /* implemented */
-extern NCURSES_EXPORT(int) init_pair (short,short,short); /* implemented */
+extern NCURSES_EXPORT(int) init_color (NCURSES_COLOR_T,NCURSES_COLOR_T,NCURSES_COLOR_T,NCURSES_COLOR_T); /* implemented */
+extern NCURSES_EXPORT(int) init_pair (NCURSES_PAIRS_T,NCURSES_COLOR_T,NCURSES_COLOR_T); /* implemented */
extern NCURSES_EXPORT(int) innstr (char *, int); /* generated */
extern NCURSES_EXPORT(int) insch (chtype); /* generated */
extern NCURSES_EXPORT(int) insdelln (int); /* generated */
extern NCURSES_EXPORT(int) mvaddchstr (int, int, const chtype *); /* generated */
extern NCURSES_EXPORT(int) mvaddnstr (int, int, const char *, int); /* generated */
extern NCURSES_EXPORT(int) mvaddstr (int, int, const char *); /* generated */
-extern NCURSES_EXPORT(int) mvchgat (int, int, int, attr_t, short, const void *); /* generated */
+extern NCURSES_EXPORT(int) mvchgat (int, int, int, attr_t, NCURSES_PAIRS_T, const void *); /* generated */
extern NCURSES_EXPORT(int) mvcur (int,int,int,int); /* implemented */
extern NCURSES_EXPORT(int) mvdelch (int, int); /* generated */
extern NCURSES_EXPORT(int) mvderwin (WINDOW *, int, int); /* implemented */
extern NCURSES_EXPORT(int) mvwaddchstr (WINDOW *, int, int, const chtype *); /* generated */
extern NCURSES_EXPORT(int) mvwaddnstr (WINDOW *, int, int, const char *, int); /* generated */
extern NCURSES_EXPORT(int) mvwaddstr (WINDOW *, int, int, const char *); /* generated */
-extern NCURSES_EXPORT(int) mvwchgat (WINDOW *, int, int, int, attr_t, short, const void *);/* generated */
+extern NCURSES_EXPORT(int) mvwchgat (WINDOW *, int, int, int, attr_t, NCURSES_PAIRS_T, const void *);/* generated */
extern NCURSES_EXPORT(int) mvwdelch (WINDOW *, int, int); /* generated */
extern NCURSES_EXPORT(int) mvwgetch (WINDOW *, int, int); /* generated */
extern NCURSES_EXPORT(int) mvwgetnstr (WINDOW *, int, int, char *, int); /* generated */
extern NCURSES_EXPORT(int) notimeout (WINDOW *,bool); /* implemented */
extern NCURSES_EXPORT(int) overlay (const WINDOW*,WINDOW *); /* implemented */
extern NCURSES_EXPORT(int) overwrite (const WINDOW*,WINDOW *); /* implemented */
-extern NCURSES_EXPORT(int) pair_content (short,short*,short*); /* implemented */
+extern NCURSES_EXPORT(int) pair_content (NCURSES_PAIRS_T,NCURSES_COLOR_T*,NCURSES_COLOR_T*); /* implemented */
extern NCURSES_EXPORT(int) PAIR_NUMBER (int); /* generated */
extern NCURSES_EXPORT(int) pechochar (WINDOW *, const chtype); /* implemented */
extern NCURSES_EXPORT(int) pnoutrefresh (WINDOW*,int,int,int,int,int,int);/* implemented */
extern NCURSES_EXPORT(int) slk_attr_on (attr_t,void*); /* generated:WIDEC */
extern NCURSES_EXPORT(int) slk_attrset (const chtype); /* implemented */
extern NCURSES_EXPORT(attr_t) slk_attr (void); /* implemented */
-extern NCURSES_EXPORT(int) slk_attr_set (const attr_t,short,void*); /* implemented */
+extern NCURSES_EXPORT(int) slk_attr_set (const attr_t,NCURSES_PAIRS_T,void*); /* implemented */
extern NCURSES_EXPORT(int) slk_clear (void); /* implemented */
-extern NCURSES_EXPORT(int) slk_color (short); /* implemented */
+extern NCURSES_EXPORT(int) slk_color (NCURSES_PAIRS_T); /* implemented */
extern NCURSES_EXPORT(int) slk_init (int); /* implemented */
extern NCURSES_EXPORT(char *) slk_label (int); /* implemented */
extern NCURSES_EXPORT(int) slk_noutrefresh (void); /* implemented */
extern NCURSES_EXPORT(int) wattron (WINDOW *, int); /* generated */
extern NCURSES_EXPORT(int) wattroff (WINDOW *, int); /* generated */
extern NCURSES_EXPORT(int) wattrset (WINDOW *, int); /* generated */
-extern NCURSES_EXPORT(int) wattr_get (WINDOW *, attr_t *, short *, void *); /* generated */
+extern NCURSES_EXPORT(int) wattr_get (WINDOW *, attr_t *, NCURSES_PAIRS_T *, void *); /* generated */
extern NCURSES_EXPORT(int) wattr_on (WINDOW *, attr_t, void *); /* implemented */
extern NCURSES_EXPORT(int) wattr_off (WINDOW *, attr_t, void *); /* implemented */
-extern NCURSES_EXPORT(int) wattr_set (WINDOW *, attr_t, short, void *); /* generated */
+extern NCURSES_EXPORT(int) wattr_set (WINDOW *, attr_t, NCURSES_PAIRS_T, void *); /* generated */
extern NCURSES_EXPORT(int) wbkgd (WINDOW *, chtype); /* implemented */
extern NCURSES_EXPORT(void) wbkgdset (WINDOW *,chtype); /* implemented */
extern NCURSES_EXPORT(int) wborder (WINDOW *,chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype); /* implemented */
-extern NCURSES_EXPORT(int) wchgat (WINDOW *, int, attr_t, short, const void *);/* implemented */
+extern NCURSES_EXPORT(int) wchgat (WINDOW *, int, attr_t, NCURSES_PAIRS_T, const void *);/* implemented */
extern NCURSES_EXPORT(int) wclear (WINDOW *); /* implemented */
extern NCURSES_EXPORT(int) wclrtobot (WINDOW *); /* implemented */
extern NCURSES_EXPORT(int) wclrtoeol (WINDOW *); /* implemented */
-extern NCURSES_EXPORT(int) wcolor_set (WINDOW*,short,void*); /* implemented */
+extern NCURSES_EXPORT(int) wcolor_set (WINDOW*,NCURSES_PAIRS_T,void*); /* implemented */
extern NCURSES_EXPORT(void) wcursyncup (WINDOW *); /* implemented */
extern NCURSES_EXPORT(int) wdelch (WINDOW *); /* implemented */
extern NCURSES_EXPORT(int) wdeleteln (WINDOW *); /* generated */
extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(can_change_color) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(cbreak) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(curs_set) (SCREEN*, int); /* implemented:SP_FUNC */
-extern NCURSES_EXPORT(int) NCURSES_SP_NAME(color_content) (SCREEN*, short, short*, short*, short*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(color_content) (SCREEN*, NCURSES_PAIRS_T, NCURSES_COLOR_T*, NCURSES_COLOR_T*, NCURSES_COLOR_T*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(def_prog_mode) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(def_shell_mode) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(delay_output) (SCREEN*, int); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(has_colors) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(has_ic) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(has_il) (SCREEN*); /* implemented:SP_FUNC */
-extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_color) (SCREEN*, short, short, short, short); /* implemented:SP_FUNC */
-extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_pair) (SCREEN*, short, short, short); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_color) (SCREEN*, NCURSES_COLOR_T, NCURSES_COLOR_T, NCURSES_COLOR_T, NCURSES_COLOR_T); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_pair) (SCREEN*, NCURSES_PAIRS_T, NCURSES_COLOR_T, NCURSES_COLOR_T); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(intrflush) (SCREEN*, WINDOW*, bool); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(isendwin) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(NCURSES_CONST char *) NCURSES_SP_NAME(keyname) (SCREEN*, int); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(nonl) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(void) NCURSES_SP_NAME(noqiflush) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(noraw) (SCREEN*); /* implemented:SP_FUNC */
-extern NCURSES_EXPORT(int) NCURSES_SP_NAME(pair_content) (SCREEN*, short, short*, short*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(pair_content) (SCREEN*, NCURSES_PAIRS_T, NCURSES_COLOR_T*, NCURSES_COLOR_T*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(void) NCURSES_SP_NAME(qiflush) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(raw) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(reset_prog_mode) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attron) (SCREEN*, const chtype); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attrset) (SCREEN*, const chtype); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(attr_t) NCURSES_SP_NAME(slk_attr) (SCREEN*); /* implemented:SP_FUNC */
-extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attr_set) (SCREEN*, const attr_t, short, void*); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attr_set) (SCREEN*, const attr_t, NCURSES_PAIRS_T, void*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_clear) (SCREEN*); /* implemented:SP_FUNC */
-extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_color) (SCREEN*, short); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_color) (SCREEN*, NCURSES_PAIRS_T); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_init) (SCREEN*, int); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(slk_label) (SCREEN*, int); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_noutrefresh) (SCREEN*); /* implemented:SP_FUNC */
: OK), \
OK)
#define wattr_get(win,a,p,opts) ((void)(((a) != (void *)0) ? (*(a) = (win) ? (win)->_attrs : 0) : OK), \
- (void)(((p) != (void *)0) ? (*(p) = (short) ((win) ? (win)->_color : 0)) : OK), \
+ (void)(((p) != (void *)0) ? (*(p) = (NCURSES_PAIRS_T) ((win) ? (win)->_color : 0)) : OK), \
OK)
#else
#define wattr_set(win,a,p,opts) (((win) \
: OK), \
OK)
#define wattr_get(win,a,p,opts) ((void)(((a) != (void *)0) ? (*(a) = (win) ? (win)->_attrs : 0) : OK), \
- (void)(((p) != (void *)0) ? (*(p) = (short) ((win) ? PAIR_NUMBER((win)->_attrs) : 0)) : OK), \
+ (void)(((p) != (void *)0) ? (*(p) = (NCURSES_PAIRS_T) ((win) ? PAIR_NUMBER((win)->_attrs) : 0)) : OK), \
OK)
#endif
#endif /* NCURSES_OPAQUE */
-/* $Id: curses.wide,v 1.45 2012/07/28 18:10:02 tom Exp $ */
+/* $Id: curses.wide,v 1.46 2014/02/01 22:00:32 tom Exp $ */
/*
* vile:cmode:
* This file is part of ncurses, designed to be appended after curses.h.in
extern NCURSES_EXPORT(int) get_wch (wint_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) get_wstr (wint_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) getbkgrnd (cchar_t *); /* generated:WIDEC */
-extern NCURSES_EXPORT(int) getcchar (const cchar_t *, wchar_t*, attr_t*, short*, void*); /* implemented */
+extern NCURSES_EXPORT(int) getcchar (const cchar_t *, wchar_t*, attr_t*, NCURSES_PAIRS_T*, void*); /* implemented */
extern NCURSES_EXPORT(int) getn_wstr (wint_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) hline_set (const cchar_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) in_wch (cchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwinwstr (WINDOW *, int, int, wchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) mvwvline_set (WINDOW *, int,int, const cchar_t *,int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) pecho_wchar (WINDOW *, const cchar_t *); /* implemented */
-extern NCURSES_EXPORT(int) setcchar (cchar_t *, const wchar_t *, const attr_t, short, const void *); /* implemented */
+extern NCURSES_EXPORT(int) setcchar (cchar_t *, const wchar_t *, const attr_t, NCURSES_PAIRS_T, const void *); /* implemented */
extern NCURSES_EXPORT(int) slk_wset (int, const wchar_t *, int); /* implemented */
extern NCURSES_EXPORT(attr_t) term_attrs (void); /* implemented */
extern NCURSES_EXPORT(int) unget_wch (const wchar_t); /* implemented */
-extern NCURSES_EXPORT(int) vid_attr (attr_t, short, void *); /* implemented */
-extern NCURSES_EXPORT(int) vid_puts (attr_t, short, void *, NCURSES_OUTC); /* implemented */
+extern NCURSES_EXPORT(int) vid_attr (attr_t, NCURSES_PAIRS_T, void *); /* implemented */
+extern NCURSES_EXPORT(int) vid_puts (attr_t, NCURSES_PAIRS_T, void *, NCURSES_OUTC); /* implemented */
extern NCURSES_EXPORT(int) vline_set (const cchar_t *, int); /* generated:WIDEC */
extern NCURSES_EXPORT(int) wadd_wch (WINDOW *,const cchar_t *); /* implemented */
extern NCURSES_EXPORT(int) wadd_wchnstr (WINDOW *,const cchar_t *,int); /* implemented */
extern NCURSES_EXPORT(attr_t) NCURSES_SP_NAME(term_attrs) (SCREEN*); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(unget_wch) (SCREEN*, const wchar_t); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(wchar_t*) NCURSES_SP_NAME(wunctrl) (SCREEN*, cchar_t *); /* implemented:SP_FUNC */
-extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vid_attr) (SCREEN*, attr_t, short, void *); /* implemented:SP_FUNC */
-extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vid_puts) (SCREEN*, attr_t, short, void *, NCURSES_SP_OUTC); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vid_attr) (SCREEN*, attr_t, NCURSES_PAIRS_T, void *); /* implemented:SP_FUNC */
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vid_puts) (SCREEN*, attr_t, NCURSES_PAIRS_T, void *, NCURSES_SP_OUTC); /* implemented:SP_FUNC */
#endif
#ifndef NCURSES_NOMACROS
/****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2010,2014 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
#include <curses.priv.h>
-MODULE_ID("$Id: lib_chgat.c,v 1.9 2010/03/31 23:38:02 tom Exp $")
+MODULE_ID("$Id: lib_chgat.c,v 1.10 2014/02/01 22:13:31 tom Exp $")
NCURSES_EXPORT(int)
-wchgat(WINDOW *win, int n, attr_t attr, short color, const void *opts GCC_UNUSED)
+wchgat(WINDOW *win,
+ int n,
+ attr_t attr,
+ NCURSES_PAIRS_T color,
+ const void *opts GCC_UNUSED)
{
int i;
- T((T_CALLED("wchgat(%p,%d,%s,%d)"), (void *) win, n, _traceattr(attr), color));
+ T((T_CALLED("wchgat(%p,%d,%s,%d)"),
+ (void *) win,
+ n,
+ _traceattr(attr),
+ (int) color));
if (win) {
struct ldat *line = &(win->_line[win->_cury]);
/****************************************************************************
- * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: lib_color.c,v 1.108 2013/03/09 22:33:38 tom Exp $")
+MODULE_ID("$Id: lib_color.c,v 1.109 2014/02/01 22:22:30 tom Exp $")
#ifdef USE_TERM_DRIVER
#define CanChange InfoOf(SP_PARM).canchange
/* This function was originally written by Daniel Weaver <danw@znyx.com> */
static void
-rgb2hls(int r, int g, int b, short *h, short *l, short *s)
+rgb2hls(int r, int g, int b, NCURSES_COLOR_T *h, NCURSES_COLOR_T *l, NCURSES_COLOR_T *s)
/* convert RGB to HLS system */
{
int min, max, t;
max = b;
/* calculate lightness */
- *l = (short) ((min + max) / 20);
+ *l = (NCURSES_COLOR_T) ((min + max) / 20);
if (min == max) { /* black, white and all shades of gray */
*h = 0;
/* calculate saturation */
if (*l < 50)
- *s = (short) (((max - min) * 100) / (max + min));
+ *s = (NCURSES_COLOR_T) (((max - min) * 100) / (max + min));
else
- *s = (short) (((max - min) * 100) / (2000 - max - min));
+ *s = (NCURSES_COLOR_T) (((max - min) * 100) / (2000 - max - min));
/* calculate hue */
if (r == max)
- t = (short) (120 + ((g - b) * 60) / (max - min));
+ t = (NCURSES_COLOR_T) (120 + ((g - b) * 60) / (max - min));
else if (g == max)
- t = (short) (240 + ((b - r) * 60) / (max - min));
+ t = (NCURSES_COLOR_T) (240 + ((b - r) * 60) / (max - min));
else
- t = (short) (360 + ((r - g) * 60) / (max - min));
+ t = (NCURSES_COLOR_T) (360 + ((r - g) * 60) / (max - min));
- *h = (short) (t % 360);
+ *h = (NCURSES_COLOR_T) (t % 360);
}
/*
* values.
*/
NCURSES_EXPORT(int)
-NCURSES_SP_NAME(init_pair) (NCURSES_SP_DCLx short pair, short f, short b)
+NCURSES_SP_NAME(init_pair) (NCURSES_SP_DCLx
+ NCURSES_PAIRS_T pair,
+ NCURSES_COLOR_T f,
+ NCURSES_COLOR_T b)
{
colorpair_t result;
colorpair_t previous;
int maxcolors;
- T((T_CALLED("init_pair(%p,%d,%d,%d)"), (void *) SP_PARM, pair, f, b));
+ T((T_CALLED("init_pair(%p,%d,%d,%d)"),
+ (void *) SP_PARM,
+ (int) pair,
+ (int) f,
+ (int) b));
if (!ValidPair(pair))
returnCode(ERR);
TR(TRACE_ATTRS,
("initializing pair: pair = %d, fg=(%d,%d,%d), bg=(%d,%d,%d)",
- pair,
- tp[f].red, tp[f].green, tp[f].blue,
- tp[b].red, tp[b].green, tp[b].blue));
+ (int) pair,
+ (int) tp[f].red, (int) tp[f].green, (int) tp[f].blue,
+ (int) tp[b].red, (int) tp[b].green, (int) tp[b].blue));
NCURSES_PUTP2("initialize_pair",
TPARM_7(initialize_pair,
pair,
- tp[f].red, tp[f].green, tp[f].blue,
- tp[b].red, tp[b].green, tp[b].blue));
+ (int) tp[f].red,
+ (int) tp[f].green,
+ (int) tp[f].blue,
+ (int) tp[b].red,
+ (int) tp[b].green,
+ (int) tp[b].blue));
}
#endif
#if NCURSES_SP_FUNCS
NCURSES_EXPORT(int)
-init_pair(short pair, short f, short b)
+init_pair(NCURSES_COLOR_T pair, NCURSES_COLOR_T f, NCURSES_COLOR_T b)
{
return NCURSES_SP_NAME(init_pair) (CURRENT_SCREEN, pair, f, b);
}
NCURSES_EXPORT(int)
NCURSES_SP_NAME(init_color) (NCURSES_SP_DCLx
- short color, short r, short g, short b)
+ NCURSES_COLOR_T color,
+ NCURSES_COLOR_T r,
+ NCURSES_COLOR_T g,
+ NCURSES_COLOR_T b)
{
int result = ERR;
int maxcolors;
#if NCURSES_SP_FUNCS
NCURSES_EXPORT(int)
-init_color(short color, short r, short g, short b)
+init_color(NCURSES_COLOR_T color,
+ NCURSES_COLOR_T r,
+ NCURSES_COLOR_T g,
+ NCURSES_COLOR_T b)
{
return NCURSES_SP_NAME(init_color) (CURRENT_SCREEN, color, r, g, b);
}
NCURSES_EXPORT(int)
NCURSES_SP_NAME(color_content) (NCURSES_SP_DCLx
- short color, short *r, short *g, short *b)
+ NCURSES_COLOR_T color,
+ NCURSES_COLOR_T *r,
+ NCURSES_COLOR_T *g,
+ NCURSES_COLOR_T *b)
{
int result = ERR;
int maxcolors;
#if NCURSES_SP_FUNCS
NCURSES_EXPORT(int)
-color_content(short color, short *r, short *g, short *b)
+color_content(NCURSES_COLOR_T color,
+ NCURSES_COLOR_T *r,
+ NCURSES_COLOR_T *g,
+ NCURSES_COLOR_T *b)
{
return NCURSES_SP_NAME(color_content) (CURRENT_SCREEN, color, r, g, b);
}
NCURSES_EXPORT(int)
NCURSES_SP_NAME(pair_content) (NCURSES_SP_DCLx
- short pair, short *f, short *b)
+ NCURSES_PAIRS_T pair,
+ NCURSES_COLOR_T *f,
+ NCURSES_COLOR_T *b)
{
int result;
T((T_CALLED("pair_content(%p,%d,%p,%p)"),
(void *) SP_PARM,
- pair,
+ (int) pair,
(void *) f,
(void *) b));
TR(TRACE_ATTRS, ("...pair_content(%p,%d,%d,%d)",
(void *) SP_PARM,
- pair,
- fg, bg));
+ (int) pair,
+ (int) fg, (int) bg));
result = OK;
}
returnCode(result);
#if NCURSES_SP_FUNCS
NCURSES_EXPORT(int)
-pair_content(short pair, short *f, short *b)
+pair_content(NCURSES_COLOR_T pair, NCURSES_COLOR_T *f, NCURSES_COLOR_T *b)
{
return NCURSES_SP_NAME(pair_content) (CURRENT_SCREEN, pair, f, b);
}
1, outc);
return;
} else if (SP_PARM != 0) {
- if (pair_content((short) pair, &fg, &bg) == ERR)
+ if (pair_content((NCURSES_COLOR_T) pair, &fg, &bg) == ERR)
return;
}
}
if (old_pair >= 0
&& SP_PARM != 0
- && pair_content((short) old_pair, &old_fg, &old_bg) != ERR) {
+ && pair_content((NCURSES_COLOR_T) old_pair, &old_fg, &old_bg) != ERR) {
if ((isDefaultColor(fg) && !isDefaultColor(old_fg))
|| (isDefaultColor(bg) && !isDefaultColor(old_bg))) {
#if NCURSES_EXT_FUNCS
#if NCURSES_EXT_FUNCS
if (isDefaultColor(fg))
- fg = (short) default_fg(NCURSES_SP_ARG);
+ fg = (NCURSES_COLOR_T) default_fg(NCURSES_SP_ARG);
if (isDefaultColor(bg))
- bg = (short) default_bg(NCURSES_SP_ARG);
+ bg = (NCURSES_COLOR_T) default_bg(NCURSES_SP_ARG);
#endif
if (reverse) {
/****************************************************************************
- * Copyright (c) 1998-2005,2009 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2014 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
#include <curses.priv.h>
#include <ctype.h>
-MODULE_ID("$Id: lib_colorset.c,v 1.13 2009/10/24 22:02:14 tom Exp $")
+MODULE_ID("$Id: lib_colorset.c,v 1.14 2014/02/01 22:10:42 tom Exp $")
NCURSES_EXPORT(int)
-wcolor_set(WINDOW *win, short color_pair_number, void *opts)
+wcolor_set(WINDOW *win, NCURSES_PAIRS_T color_pair_number, void *opts)
{
int code = ERR;
- T((T_CALLED("wcolor_set(%p,%d)"), (void *) win, color_pair_number));
+ T((T_CALLED("wcolor_set(%p,%d)"), (void *) win, (int) color_pair_number));
if (win
&& !opts
&& (SP != 0)
/****************************************************************************
- * Copyright (c) 1998-2011,2013 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
#include <curses.priv.h>
-MODULE_ID("$Id: lib_instr.c,v 1.20 2013/01/20 01:58:13 tom Exp $")
+MODULE_ID("$Id: lib_instr.c,v 1.21 2014/02/01 22:09:27 tom Exp $")
NCURSES_EXPORT(int)
winnstr(WINDOW *win, char *str, int n)
cchar_t *cell = &(win->_line[row].text[col]);
wchar_t *wch;
attr_t attrs;
- short pair;
+ NCURSES_PAIRS_T pair;
int n2;
bool done = FALSE;
mbstate_t state;
/****************************************************************************
- * Copyright (c) 1998-2005,2009 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2014 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
*/
#include <curses.priv.h>
-MODULE_ID("$Id: lib_slkatr_set.c,v 1.14 2009/10/24 22:47:03 tom Exp $")
+MODULE_ID("$Id: lib_slkatr_set.c,v 1.15 2014/02/01 22:10:42 tom Exp $")
NCURSES_EXPORT(int)
NCURSES_SP_NAME(slk_attr_set) (NCURSES_SP_DCLx
const attr_t attr,
- short color_pair_number,
+ NCURSES_PAIRS_T color_pair_number,
void *opts)
{
int code = ERR;
T((T_CALLED("slk_attr_set(%p,%s,%d)"),
(void *) SP_PARM,
_traceattr(attr),
- color_pair_number));
+ (int) color_pair_number));
if (SP_PARM != 0
&& SP_PARM->_slk != 0
#if NCURSES_SP_FUNCS
NCURSES_EXPORT(int)
-slk_attr_set(const attr_t attr, short color_pair_number, void *opts)
+slk_attr_set(const attr_t attr, NCURSES_COLOR_T color_pair_number, void *opts)
{
return NCURSES_SP_NAME(slk_attr_set) (CURRENT_SCREEN, attr,
color_pair_number, opts);
/****************************************************************************
- * Copyright (c) 1998-2005,2009 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,2014 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
*/
#include <curses.priv.h>
-MODULE_ID("$Id: lib_slkcolor.c,v 1.16 2009/10/24 22:12:21 tom Exp $")
+MODULE_ID("$Id: lib_slkcolor.c,v 1.17 2014/02/01 22:10:42 tom Exp $")
NCURSES_EXPORT(int)
-NCURSES_SP_NAME(slk_color) (NCURSES_SP_DCLx short color_pair_number)
+NCURSES_SP_NAME(slk_color) (NCURSES_SP_DCLx NCURSES_PAIRS_T color_pair_number)
{
int code = ERR;
- T((T_CALLED("slk_color(%p,%d)"), (void *) SP_PARM, color_pair_number));
+ T((T_CALLED("slk_color(%p,%d)"), (void *) SP_PARM, (int) color_pair_number));
if (SP_PARM != 0
&& SP_PARM->_slk != 0
#if NCURSES_SP_FUNCS
NCURSES_EXPORT(int)
-slk_color(short color_pair_number)
+slk_color(NCURSES_PAIRS_T color_pair_number)
{
return NCURSES_SP_NAME(slk_color) (CURRENT_SCREEN, color_pair_number);
}
/****************************************************************************
- * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
****************************************************************************/
/*
- * $Id: curses.priv.h,v 1.529 2013/11/16 19:44:28 tom Exp $
+ * $Id: curses.priv.h,v 1.530 2014/02/01 22:09:27 tom Exp $
*
* curses.priv.h
*
* Structure for palette tables
*/
-typedef struct
-{
- short red, green, blue; /* what color_content() returns */
- short r, g, b; /* params to init_color() */
- int init; /* true if we called init_color() */
-}
-color_t;
-
#define MAXCOLUMNS 135
#define MAXLINES 66
#define FIFO_SIZE MAXCOLUMNS+2 /* for nocbreak mode input */
#include <curses.h> /* we'll use -Ipath directive to get the right one! */
+typedef struct
+{
+ NCURSES_COLOR_T red, green, blue; /* what color_content() returns */
+ NCURSES_COLOR_T r, g, b; /* params to init_color() */
+ int init; /* true if we called init_color() */
+}
+color_t;
+
/*
* If curses.h did not expose the SCREEN-functions, then we do not need the
* parameter in the corresponding unextended functions.
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_setupscreen)(SCREEN**, int, int, FILE *, int, int);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_tgetent)(SCREEN*,char*,const char *);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_tigetnum)(SCREEN*,NCURSES_CONST char*);
-extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_vid_attr)(SCREEN *, attr_t, short, void *);
+extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_vid_attr)(SCREEN *, attr_t, NCURSES_COLOR_T, void *);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_vidputs)(SCREEN*,chtype,int(*) (SCREEN*, int));
extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_do_color)(SCREEN*, int, int, int, NCURSES_SP_OUTC);
extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_do_xmc_glitch)(SCREEN*, attr_t);
/****************************************************************************
- * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: lib_traceatr.c,v 1.80 2013/08/31 13:33:06 tom Exp $")
+MODULE_ID("$Id: lib_traceatr.c,v 1.81 2014/02/01 22:09:27 tom Exp $")
#define COLOR_OF(c) ((c < 0) ? "default" : (c > 7 ? color_of(c) : colors[c].name))
_nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp))
"{%d}", pairnum);
#else
- short fg, bg;
+ NCURSES_COLOR_T fg, bg;
if (pair_content(pairnum, &fg, &bg) == OK) {
_nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp))
/****************************************************************************
- * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
#include <ctype.h>
-MODULE_ID("$Id: tty_update.c,v 1.276 2013/02/16 21:12:02 tom Exp $")
+MODULE_ID("$Id: tty_update.c,v 1.277 2014/02/01 22:09:27 tom Exp $")
/*
* This define controls the line-breakout optimization. Every once in a
if (SP_PARM->_default_fg != C_MASK || SP_PARM->_default_bg != C_MASK)
return FALSE;
if ((pair = GetPair(CHDEREF(ch))) != 0) {
- short fg, bg;
+ NCURSES_COLOR_T fg, bg;
if (NCURSES_SP_NAME(pair_content) (NCURSES_SP_ARGx
(short) pair,
&fg, &bg) == ERR
/****************************************************************************
- * Copyright (c) 2001-2011,2012 Free Software Foundation, Inc. *
+ * Copyright (c) 2001-2012,2014 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
#include <curses.priv.h>
-MODULE_ID("$Id: lib_cchar.c,v 1.26 2012/03/24 18:37:17 tom Exp $")
+MODULE_ID("$Id: lib_cchar.c,v 1.27 2014/02/01 22:10:42 tom Exp $")
/*
* The SuSv2 description leaves some room for interpretation. We'll assume wch
setcchar(cchar_t *wcval,
const wchar_t *wch,
const attr_t attrs,
- short color_pair,
+ NCURSES_PAIRS_T color_pair,
const void *opts)
{
unsigned i;
TR(TRACE_CCALLS, (T_CALLED("setcchar(%p,%s,%lu,%d,%p)"),
(void *) wcval, _nc_viswbuf(wch),
- (unsigned long) attrs, color_pair, opts));
+ (unsigned long) attrs, (int) color_pair, opts));
if (opts != NULL
|| wch == NULL
getcchar(const cchar_t *wcval,
wchar_t *wch,
attr_t *attrs,
- short *color_pair,
+ NCURSES_PAIRS_T *color_pair,
void *opts)
{
wchar_t *wp;
code = ERR;
} else if (len >= 0) {
*attrs = AttrOf(*wcval) & A_ATTRIBUTES;
- *color_pair = (short) GetPair(*wcval);
+ *color_pair = (NCURSES_PAIRS_T) GetPair(*wcval);
wmemcpy(wch, wcval->chars, (size_t) len);
wch[len] = L'\0';
code = OK;
/****************************************************************************
- * Copyright (c) 2002-2012,2013 Free Software Foundation, Inc. *
+ * Copyright (c) 2002-2013,2014 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: lib_vid_attr.c,v 1.21 2013/08/31 20:09:12 tom Exp $")
+MODULE_ID("$Id: lib_vid_attr.c,v 1.22 2014/02/01 22:09:27 tom Exp $")
#define doPut(mode) \
TPUTS_TRACE(#mode); \
NCURSES_EXPORT(int)
NCURSES_SP_NAME(vid_puts) (NCURSES_SP_DCLx
attr_t newmode,
- short pair,
+ NCURSES_PAIRS_T pair,
void *opts GCC_UNUSED,
NCURSES_SP_OUTC outc)
{
returnCode(OK);
#else
- T((T_CALLED("vid_puts(%s,%d)"), _traceattr(newmode), pair));
+ T((T_CALLED("vid_puts(%s,%d)"), _traceattr(newmode), (int) pair));
set_color(newmode, pair);
returnCode(NCURSES_SP_NAME(vidputs) (NCURSES_SP_ARGx newmode, outc));
#endif
#if NCURSES_SP_FUNCS
NCURSES_EXPORT(int)
vid_puts(attr_t newmode,
- short pair,
+ NCURSES_PAIRS_T pair,
void *opts GCC_UNUSED,
NCURSES_OUTC outc)
{
NCURSES_EXPORT(int)
NCURSES_SP_NAME(vid_attr) (NCURSES_SP_DCLx
attr_t newmode,
- short pair,
+ NCURSES_PAIRS_T pair,
void *opts)
{
- T((T_CALLED("vid_attr(%s,%d)"), _traceattr(newmode), pair));
+ T((T_CALLED("vid_attr(%s,%d)"), _traceattr(newmode), (int) pair));
returnCode(NCURSES_SP_NAME(vid_puts) (NCURSES_SP_ARGx
newmode,
pair,
#if NCURSES_SP_FUNCS
NCURSES_EXPORT(int)
-vid_attr(attr_t newmode, short pair, void *opts)
+vid_attr(attr_t newmode, NCURSES_PAIRS_T pair, void *opts)
{
return NCURSES_SP_NAME(vid_attr) (CURRENT_SCREEN, newmode, pair, opts);
}
-ncurses6 (5.9-20140125) unstable; urgency=low
+ncurses6 (5.9-20140201) unstable; urgency=low
* latest weekly patch
- -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 25 Jan 2014 11:16:43 -0500
+ -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 01 Feb 2014 12:10:27 -0500
ncurses6 (5.9-20131005) unstable; urgency=low
-ncurses6 (5.9-20140125) unstable; urgency=low
+ncurses6 (5.9-20140201) unstable; urgency=low
* latest weekly patch
- -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 25 Jan 2014 11:16:43 -0500
+ -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 01 Feb 2014 12:10:27 -0500
ncurses6 (5.9-20131005) unstable; urgency=low
-ncurses6 (5.9-20140125) unstable; urgency=low
+ncurses6 (5.9-20140201) unstable; urgency=low
* latest weekly patch
- -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 25 Jan 2014 11:16:43 -0500
+ -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 01 Feb 2014 12:10:27 -0500
ncurses6 (5.9-20120608) unstable; urgency=low
-; $Id: mingw-ncurses.nsi,v 1.22 2014/01/25 16:16:43 tom Exp $\r
+; $Id: mingw-ncurses.nsi,v 1.23 2014/02/01 17:10:27 tom Exp $\r
\r
; TODO add examples\r
; TODO bump ABI to 6\r
!define VERSION_MAJOR "5"\r
!define VERSION_MINOR "9"\r
!define VERSION_YYYY "2014"\r
-!define VERSION_MMDD "125"\r
+!define VERSION_MMDD "201"\r
!define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD}\r
\r
!define MY_ABI "5"\r
Summary: shared libraries for terminal handling
Name: mingw32-ncurses6
Version: 5.9
-Release: 20140125
+Release: 20140201
License: X11
Group: Development/Libraries
Source: ncurses-%{version}-%{release}.tgz
Summary: shared libraries for terminal handling
Name: ncurses6
Version: 5.9
-Release: 20140125
+Release: 20140201
License: X11
Group: Development/Libraries
Source: ncurses-%{version}-%{release}.tgz
/****************************************************************************
- * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
#include <dump_entry.h>
-MODULE_ID("$Id: infocmp.c,v 1.128 2013/12/15 01:06:52 tom Exp $")
+MODULE_ID("$Id: infocmp.c,v 1.129 2014/02/01 22:11:03 tom Exp $")
#define L_CURL "{"
#define R_CURL "}"
/* now check for standard-mode sequences */
if (!expansion
&& (csi = skip_csi(sp)) != 0
- && (len = strspn(sp + csi, "0123456789;"))
+ && (len = (strspn) (sp + csi, "0123456789;"))
&& (len < sizeof(buf3))
&& (next = (size_t) csi + len)
&& ((sp[next] == 'h') || (sp[next] == 'l'))) {
if (!expansion
&& (csi = skip_csi(sp)) != 0
&& sp[csi] == '?'
- && (len = strspn(sp + csi + 1, "0123456789;"))
+ && (len = (strspn) (sp + csi + 1, "0123456789;"))
&& (len < sizeof(buf3))
&& (next = (size_t) csi + 1 + len)
&& ((sp[next] == 'h') || (sp[next] == 'l'))) {
/* now check for ECMA highlight sequences */
if (!expansion
&& (csi = skip_csi(sp)) != 0
- && (len = strspn(sp + csi, "0123456789;")) != 0
+ && (len = (strspn) (sp + csi, "0123456789;")) != 0
&& (len < sizeof(buf3))
&& (next = (size_t) csi + len)
&& sp[next] == 'm') {
/****************************************************************************
- * Copyright (c) 2003-2011,2012 Free Software Foundation, Inc. *
+ * Copyright (c) 2003-2012,2014 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* authorization. *
****************************************************************************/
/*
- * $Id: background.c,v 1.13 2012/06/09 20:30:33 tom Exp $
+ * $Id: background.c,v 1.14 2014/02/01 22:10:42 tom Exp $
*/
#define NEED_COLOR_CODE 1
static void
test_background(void)
{
- short f, b;
+ NCURSES_COLOR_T f, b;
int row;
int chr;
if (pair_content(0, &f, &b) == ERR) {
printw("pair 0 contains no data\n");
} else {
- printw("pair 0 contains (%d,%d)\n", f, b);
+ printw("pair 0 contains (%d,%d)\n", (int) f, (int) b);
}
getch();
printw("Initializing pair 1 to red/%s\n", color_name(default_bg));
- init_pair(1, COLOR_RED, (short) default_bg);
+ init_pair(1, COLOR_RED, (NCURSES_COLOR_T) default_bg);
bkgdset((chtype) (' ' | COLOR_PAIR(1)));
printw("RED/BLACK\n");
getch();
printw("Initializing pair 2 to %s/blue\n", color_name(default_fg));
- init_pair(2, (short) default_fg, COLOR_BLUE);
+ init_pair(2, (NCURSES_COLOR_T) default_fg, COLOR_BLUE);
bkgdset((chtype) (' ' | COLOR_PAIR(2)));
printw("This line should be %s/blue\n", color_name(default_fg));
getch();
printw("Initializing pair 3 to %s/cyan (ACS_HLINE)\n", color_name(default_fg));
- init_pair(3, (short) default_fg, COLOR_CYAN);
+ init_pair(3, (NCURSES_COLOR_T) default_fg, COLOR_CYAN);
printw("...and drawing a box which should be followed by lines\n");
bkgdset(ACS_HLINE | COLOR_PAIR(3));
/*
/****************************************************************************
- * Copyright (c) 2003-2008,2012 Free Software Foundation, Inc. *
+ * Copyright (c) 2003-2012,2014 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* authorization. *
****************************************************************************/
/*
- * $Id: color_set.c,v 1.7 2012/12/15 22:04:14 tom Exp $
+ * $Id: color_set.c,v 1.8 2014/02/01 22:10:42 tom Exp $
*/
#include <test.priv.h>
int
main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
{
- short f, b;
+ NCURSES_COLOR_T f, b;
int i;
initscr();
start_color();
(void) pair_content(0, &f, &b);
- printw("pair 0 contains (%d,%d)\n", f, b);
+ printw("pair 0 contains (%d,%d)\n", (int) f, (int) b);
getch();
printw("Initializing pair 1 to red/black\n");
/****************************************************************************
- * Copyright (c) 2013 Free Software Foundation, Inc. *
+ * Copyright (c) 2013,2014 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
****************************************************************************/
/*
- * $Id: form_driver_w.c,v 1.9 2013/12/07 20:35:54 tom Exp $
+ * $Id: form_driver_w.c,v 1.10 2014/02/01 20:49:39 Gaute.Hope Exp $
*
* Test form_driver_w (int, int, wchar_t), a wide char aware
* replacement of form_driver.
switch (ch) {
case KEY_DOWN:
/* Go to next field */
- form_driver(my_form, REQ_NEXT_FIELD);
+ form_driver_w(my_form, KEY_CODE_YES, REQ_NEXT_FIELD);
/* Go to the end of the present buffer */
/* Leaves nicely at the last character */
- form_driver(my_form, REQ_END_LINE);
+ form_driver_w(my_form, KEY_CODE_YES, REQ_END_LINE);
break;
case KEY_UP:
/* Go to previous field */
- form_driver(my_form, REQ_PREV_FIELD);
- form_driver(my_form, REQ_END_LINE);
+ form_driver_w(my_form, KEY_CODE_YES, REQ_PREV_FIELD);
+ form_driver_w(my_form, KEY_CODE_YES, REQ_END_LINE);
break;
default:
-#if 0
- /* If this is a normal character, it gets printed */
- form_driver(my_form, ch);
- wadd_wch(my_form->current->working, ch);
-#endif
break;
}
break;
/****************************************************************************
- * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
Author: Eric S. Raymond <esr@snark.thyrsus.com> 1993
Thomas E. Dickey (beginning revision 1.27 in 1996).
-$Id: ncurses.c,v 1.396 2013/11/23 21:43:51 tom Exp $
+$Id: ncurses.c,v 1.397 2014/02/01 22:29:37 tom Exp $
***************************************************************************/
static int max_pairs; /* ...and the number of color pairs */
typedef struct {
- short red;
- short green;
- short blue;
+ NCURSES_COLOR_T red;
+ NCURSES_COLOR_T green;
+ NCURSES_COLOR_T blue;
} RGB_DATA;
static RGB_DATA *all_colors;
}
static bool
-cycle_color_attr(int ch, short *fg, short *bg, short *tx)
+cycle_color_attr(int ch, NCURSES_COLOR_T *fg, NCURSES_COLOR_T *bg, NCURSES_COLOR_T *tx)
{
bool error = FALSE;
if (use_colors) {
switch (ch) {
case 'f':
- *fg = (short) (*fg + 1);
+ *fg = (NCURSES_COLOR_T) (*fg + 1);
break;
case 'F':
- *fg = (short) (*fg - 1);
+ *fg = (NCURSES_COLOR_T) (*fg - 1);
break;
case 'b':
- *bg = (short) (*bg + 1);
+ *bg = (NCURSES_COLOR_T) (*bg + 1);
break;
case 'B':
- *bg = (short) (*bg - 1);
+ *bg = (NCURSES_COLOR_T) (*bg - 1);
break;
case 't':
- *tx = (short) (*tx + 1);
+ *tx = (NCURSES_COLOR_T) (*tx + 1);
break;
case 'T':
- *tx = (short) (*tx - 1);
+ *tx = (NCURSES_COLOR_T) (*tx - 1);
break;
default:
beep();
break;
}
if (*fg >= COLORS)
- *fg = (short) min_colors;
+ *fg = (NCURSES_COLOR_T) min_colors;
if (*fg < min_colors)
- *fg = (short) (COLORS - 1);
+ *fg = (NCURSES_COLOR_T) (COLORS - 1);
if (*bg >= COLORS)
- *bg = (short) min_colors;
+ *bg = (NCURSES_COLOR_T) min_colors;
if (*bg < min_colors)
- *bg = (short) (COLORS - 1);
+ *bg = (NCURSES_COLOR_T) (COLORS - 1);
if (*tx >= COLORS)
*tx = -1;
if (*tx < -1)
- *tx = (short) (COLORS - 1);
+ *tx = (NCURSES_COLOR_T) (COLORS - 1);
} else {
beep();
error = TRUE;
}
static bool
-attr_getc(int *skip, short *fg, short *bg, short *tx, int *ac, unsigned *kc, unsigned limit)
+attr_getc(int *skip,
+ NCURSES_COLOR_T *fg,
+ NCURSES_COLOR_T *bg,
+ NCURSES_COLOR_T *tx,
+ int *ac,
+ unsigned *kc,
+ unsigned limit)
{
bool result = TRUE;
bool error = FALSE;
{
int n;
int skip = get_xmc();
- short fg = COLOR_BLACK; /* color pair 0 is special */
- short bg = COLOR_BLACK;
- short tx = -1;
+ NCURSES_COLOR_T fg = COLOR_BLACK; /* color pair 0 is special */
+ NCURSES_COLOR_T bg = COLOR_BLACK;
+ NCURSES_COLOR_T tx = -1;
int ac = 0;
unsigned j, k;
ATTR_TBL my_list[SIZEOF(attrs_to_test)];
chtype extras = (chtype) ac;
if (use_colors) {
- short pair = (short) (fg != COLOR_BLACK || bg != COLOR_BLACK);
- if (pair != 0) {
+ NCURSES_PAIRS_T pair = 0;
+ if ((fg != COLOR_BLACK) || (bg != COLOR_BLACK)) {
pair = 1;
if (init_pair(pair, fg, bg) == ERR) {
beep();
}
static void
-set_wide_background(short pair)
+set_wide_background(NCURSES_PAIRS_T pair)
{
cchar_t normal;
wchar_t blank[2];
attr_t result = A_NORMAL;
attr_t attr;
cchar_t ch;
- short pair;
+ NCURSES_PAIRS_T pair;
wchar_t wch[10];
memset(&ch, 0, sizeof(ch));
}
static int
-wide_show_attr(int row, int skip, bool arrow, chtype attr, short pair, const char *name)
+wide_show_attr(int row,
+ int skip,
+ bool arrow,
+ chtype attr,
+ NCURSES_PAIRS_T pair,
+ const char *name)
{
int ncv = get_ncv();
chtype test = attr & ~WA_ALTCHARSET;
}
} else {
attr_t old_attr = 0;
- short old_pair = 0;
+ NCURSES_PAIRS_T old_pair = 0;
(void) (attr_get) (&old_attr, &old_pair, 0);
(void) attr_set(attr, pair, 0);
static bool
wide_attr_getc(int *skip,
- short *fg, short *bg,
- short *tx, int *ac,
+ NCURSES_COLOR_T *fg, NCURSES_COLOR_T *bg,
+ NCURSES_COLOR_T *tx, int *ac,
unsigned *kc, unsigned limit)
{
bool result = TRUE;
{
int n;
int skip = get_xmc();
- short fg = COLOR_BLACK; /* color pair 0 is special */
- short bg = COLOR_BLACK;
- short tx = -1;
+ NCURSES_COLOR_T fg = COLOR_BLACK; /* color pair 0 is special */
+ NCURSES_COLOR_T bg = COLOR_BLACK;
+ NCURSES_COLOR_T tx = -1;
int ac = 0;
unsigned j, k;
ATTR_TBL my_list[SIZEOF(attrs_to_test)];
do {
int row = 2;
- short pair = 0;
- short extras = 0;
+ NCURSES_PAIRS_T pair = 0;
+ NCURSES_PAIRS_T extras = 0;
if (use_colors) {
- pair = (short) (fg != COLOR_BLACK || bg != COLOR_BLACK);
+ pair = (NCURSES_PAIRS_T) (fg != COLOR_BLACK || bg != COLOR_BLACK);
if (pair != 0) {
pair = 1;
if (init_pair(pair, fg, bg) == ERR) {
static void
color_test(void)
{
- short i;
+ NCURSES_PAIRS_T i;
int top = 0, width;
int base_row = 0;
int grid_top = top + 3;
show_color_name(top + 2, (i + 1) * width, i + min_colors, opt_wide);
/* show a grid of colors, with color names/ numbers on the left */
- for (i = (short) (base_row * per_row); i < pairs_max; i++) {
+ for (i = (NCURSES_PAIRS_T) (base_row * per_row); i < pairs_max; i++) {
int row = grid_top + (i / per_row) - base_row;
int col = (i % per_row + 1) * width;
- short pair = i;
+ NCURSES_PAIRS_T pair = i;
-#define InxToFG(i) (short) ((i % (COLORS - min_colors)) + min_colors)
-#define InxToBG(i) (short) ((i / (COLORS - min_colors)) + min_colors)
+#define InxToFG(i) (NCURSES_COLOR_T) ((i % (COLORS - min_colors)) + min_colors)
+#define InxToBG(i) (NCURSES_COLOR_T) ((i / (COLORS - min_colors)) + min_colors)
if (row >= 0 && move(row, col) != ERR) {
- short fg = InxToFG(i);
- short bg = InxToBG(i);
+ NCURSES_COLOR_T fg = InxToFG(i);
+ NCURSES_COLOR_T bg = InxToBG(i);
init_pair(pair, fg, bg);
attron((attr_t) COLOR_PAIR(pair));
attron((attr_t) A_REVERSE);
if (opt_nums) {
- sprintf(numbered, "{%02X}", i);
+ sprintf(numbered, "{%02X}", (int) i);
hello = numbered;
}
printw("%-*.*s", width, width, hello);
for (i = (base_row * per_row); i < pairs_max; i++) {
int row = grid_top + (i / per_row) - base_row;
int col = (i % per_row + 1) * width;
- short pair = (short) i;
+ NCURSES_PAIRS_T pair = (NCURSES_PAIRS_T) i;
if (row >= 0 && move(row, col) != ERR) {
init_pair(pair, InxToFG(i), InxToBG(i));
#endif /* USE_WIDEC_SUPPORT */
static void
-change_color(short current, int field, int value, int usebase)
+change_color(NCURSES_PAIRS_T current, int field, int value, int usebase)
{
- short red, green, blue;
+ NCURSES_COLOR_T red, green, blue;
color_content(current, &red, &green, &blue);
switch (field) {
case 0:
- red = (short) (usebase ? (red + value) : value);
+ red = (NCURSES_COLOR_T) (usebase ? (red + value) : value);
break;
case 1:
- green = (short) (usebase ? (green + value) : value);
+ green = (NCURSES_COLOR_T) (usebase ? (green + value) : value);
break;
case 2:
- blue = (short) (usebase ? (blue + value) : value);
+ blue = (NCURSES_COLOR_T) (usebase ? (blue + value) : value);
break;
}
static void
init_all_colors(void)
{
- short c;
+ NCURSES_PAIRS_T c;
for (c = 0; c < COLORS; ++c)
init_color(c,
refresh();
for (i = 0; i < max_colors; i++)
- init_pair((short) i, (short) COLOR_WHITE, (short) i);
+ init_pair((NCURSES_PAIRS_T) i,
+ (NCURSES_COLOR_T) COLOR_WHITE,
+ (NCURSES_COLOR_T) i);
MvPrintw(LINES - 2, 0, "Number: %d", value);
do {
- short red, green, blue;
+ NCURSES_COLOR_T red, green, blue;
attron(A_BOLD);
MvAddStr(0, 20, "Color RGB Value Editing");
attroff(A_BOLD);
- for (i = (short) top_color;
+ for (i = (NCURSES_COLOR_T) top_color;
(i - top_color < page_size)
&& (i < max_colors); i++) {
char numeric[80];
addstr(" ");
(void) attrset(A_NORMAL);
- color_content((short) i, &red, &green, &blue);
+ color_content((NCURSES_PAIRS_T) i, &red, &green, &blue);
addstr(" R = ");
if (current == i && field == 0)
attron(A_STANDOUT);
- printw("%04d", red);
+ printw("%04d", (int) red);
if (current == i && field == 0)
(void) attrset(A_NORMAL);
addstr(", G = ");
if (current == i && field == 1)
attron(A_STANDOUT);
- printw("%04d", green);
+ printw("%04d", (int) green);
if (current == i && field == 1)
(void) attrset(A_NORMAL);
addstr(", B = ");
if (current == i && field == 2)
attron(A_STANDOUT);
- printw("%04d", blue);
+ printw("%04d", (int) blue);
if (current == i && field == 2)
(void) attrset(A_NORMAL);
(void) attrset(A_NORMAL);
printw(" ( %3d %3d %3d )",
- scaled_rgb(red),
- scaled_rgb(green),
- scaled_rgb(blue));
+ (int) scaled_rgb(red),
+ (int) scaled_rgb(green),
+ (int) scaled_rgb(blue));
}
MvAddStr(LINES - 3, 0,
break;
case '+':
- change_color((short) current, field, value, 1);
+ change_color((NCURSES_PAIRS_T) current, field, value, 1);
break;
case '-':
- change_color((short) current, field, -value, 1);
+ change_color((NCURSES_PAIRS_T) current, field, -value, 1);
break;
case '=':
- change_color((short) current, field, value, 0);
+ change_color((NCURSES_PAIRS_T) current, field, value, 0);
break;
case '?':
endwin();
main_menu(FALSE);
for (i = 0; i < max_colors; i++)
- init_pair((short) i, (short) COLOR_WHITE, (short) i);
+ init_pair((NCURSES_PAIRS_T) i,
+ (NCURSES_COLOR_T) COLOR_WHITE,
+ (NCURSES_COLOR_T) i);
refresh();
break;
}
static bool
-cycle_colors(int ch, int *fg, int *bg, short *pair)
+cycle_colors(int ch, int *fg, int *bg, NCURSES_PAIRS_T *pair)
{
bool result = FALSE;
break;
}
if (result) {
- *pair = (short) (*fg != COLOR_BLACK || *bg != COLOR_BLACK);
+ *pair = (NCURSES_PAIRS_T) (*fg != COLOR_BLACK || *bg != COLOR_BLACK);
if (*pair != 0) {
*pair = 1;
- if (init_pair(*pair, (short) *fg, (short) *bg) == ERR) {
+ if (init_pair(*pair,
+ (NCURSES_COLOR_T) *fg,
+ (NCURSES_COLOR_T) *bg) == ERR) {
result = FALSE;
}
}
static void
call_slk_color(int fg, int bg)
{
- init_pair(1, (short) bg, (short) fg);
+ init_pair(1, (NCURSES_COLOR_T) bg, (NCURSES_COLOR_T) fg);
slk_color(1);
MvPrintw(SLK_WORK, 0, "Colors %d/%d\n", fg, bg);
clrtoeol();
#if HAVE_SLK_COLOR
int fg = COLOR_BLACK;
int bg = COLOR_WHITE;
- short pair = 0;
+ NCURSES_PAIRS_T pair = 0;
#endif
ATTR_TBL my_list[SIZEOF(attrs_to_test)];
unsigned my_size = init_attr_list(my_list, termattrs());
unsigned at_code = 0;
int fg = COLOR_BLACK;
int bg = COLOR_WHITE;
- short pair = 0;
+ NCURSES_PAIRS_T pair = 0;
ATTR_TBL my_list[SIZEOF(attrs_to_test)];
unsigned my_size = init_attr_list(my_list, term_attrs());
case 'F':
if (use_colors) {
- fg = (short) ((fg + 1) % COLORS);
+ fg = (NCURSES_COLOR_T) ((fg + 1) % COLORS);
call_slk_color(fg, bg);
}
break;
case 'B':
if (use_colors) {
- bg = (short) ((bg + 1) % COLORS);
+ bg = (NCURSES_COLOR_T) ((bg + 1) % COLORS);
call_slk_color(fg, bg);
}
break;
#endif
default:
if (cycle_attr(c, &at_code, &attr, my_list, my_size)) {
- slk_attr_set(attr, (short) (fg || bg), NULL);
+ slk_attr_set(attr, (NCURSES_COLOR_T) (fg || bg), NULL);
slk_touch();
slk_noutrefresh();
break;
#endif /* SLK_INIT */
static void
-show_256_chars(int repeat, attr_t attr, short pair)
+show_256_chars(int repeat, attr_t attr, NCURSES_PAIRS_T pair)
{
unsigned first = 0;
unsigned last = 255;
* terminal to perform functions. The remaining codes can be graphic.
*/
static void
-show_upper_chars(int base, int pagesize, int repeat, attr_t attr, short pair)
+show_upper_chars(int base, int pagesize, int repeat, attr_t attr, NCURSES_PAIRS_T pair)
{
unsigned code;
unsigned first = (unsigned) base;
#define PC_COLS 4
static void
-show_pc_chars(int repeat, attr_t attr, short pair)
+show_pc_chars(int repeat, attr_t attr, NCURSES_PAIRS_T pair)
{
unsigned code;
}
static void
-show_box_chars(int repeat, attr_t attr, short pair)
+show_box_chars(int repeat, attr_t attr, NCURSES_PAIRS_T pair)
{
(void) repeat;
}
static void
-show_acs_chars(int repeat, attr_t attr, short pair)
+show_acs_chars(int repeat, attr_t attr, NCURSES_PAIRS_T pair)
/* display the ACS character set */
{
int n;
int fg = COLOR_BLACK;
int bg = COLOR_BLACK;
unsigned at_code = 0;
- short pair = 0;
- void (*last_show_acs) (int, attr_t, short) = 0;
+ NCURSES_PAIRS_T pair = 0;
+ void (*last_show_acs) (int, attr_t, NCURSES_PAIRS_T) = 0;
ATTR_TBL my_list[SIZEOF(attrs_to_test)];
unsigned my_size = init_attr_list(my_list, termattrs());
#if USE_WIDEC_SUPPORT
static cchar_t *
-merge_wide_attr(cchar_t *dst, const cchar_t *src, attr_t attr, short pair)
+merge_wide_attr(cchar_t *dst, const cchar_t *src, attr_t attr, NCURSES_PAIRS_T pair)
{
int count;
int repeat,
int space,
attr_t attr,
- short pair)
+ NCURSES_PAIRS_T pair)
{
int first = base * pagesize;
int last = first + pagesize - 1;
}
static void
-show_upper_widechars(int first, int repeat, int space, attr_t attr, short pair)
+show_upper_widechars(int first, int repeat, int space, attr_t attr, NCURSES_PAIRS_T pair)
{
cchar_t temp;
wchar_t code;
#define MERGE_ATTR(wch) merge_wide_attr(&temp, wch, attr, pair)
static void
-show_wacs_chars(int repeat, attr_t attr, short pair)
+show_wacs_chars(int repeat, attr_t attr, NCURSES_PAIRS_T pair)
/* display the wide-ACS character set */
{
cchar_t temp;
#ifdef WACS_D_PLUS
static void
-show_wacs_chars_double(int repeat, attr_t attr, short pair)
+show_wacs_chars_double(int repeat, attr_t attr, NCURSES_PAIRS_T pair)
/* display the wide-ACS character set */
{
cchar_t temp;
#ifdef WACS_T_PLUS
static void
-show_wacs_chars_thick(int repeat, attr_t attr, short pair)
+show_wacs_chars_thick(int repeat, attr_t attr, NCURSES_PAIRS_T pair)
/* display the wide-ACS character set */
{
cchar_t temp;
#define MERGE_ATTR(n,wch) merge_wide_attr(&temp[n], wch, attr, pair)
static void
-show_wbox_chars(int repeat, attr_t attr, short pair)
+show_wbox_chars(int repeat, attr_t attr, NCURSES_PAIRS_T pair)
{
cchar_t temp[8];
#undef MERGE_ATTR
static int
-show_2_wacs(int n, const char *name, const char *code, attr_t attr, short pair)
+show_2_wacs(int n, const char *name, const char *code, attr_t attr, NCURSES_PAIRS_T pair)
{
const int height = 16;
int row = 2 + (n % height);
#define SHOW_UTF8(n, name, code) show_2_wacs(n, name, code, attr, pair)
static void
-show_utf8_chars(int repeat, attr_t attr, short pair)
+show_utf8_chars(int repeat, attr_t attr, NCURSES_PAIRS_T pair)
{
int n;
int fg = COLOR_BLACK;
int bg = COLOR_BLACK;
unsigned at_code = 0;
- short pair = 0;
- void (*last_show_wacs) (int, attr_t, short) = 0;
+ NCURSES_PAIRS_T pair = 0;
+ void (*last_show_wacs) (int, attr_t, NCURSES_PAIRS_T) = 0;
ATTR_TBL my_list[SIZEOF(attrs_to_test)];
unsigned my_size = init_attr_list(my_list, term_attrs());
mkpanel(rows,cols,tly,tlx) - alloc a win and panel and associate them
--------------------------------------------------------------------------*/
static PANEL *
-mkpanel(short color, int rows, int cols, int tly, int tlx)
+mkpanel(NCURSES_COLOR_T color, int rows, int cols, int tly, int tlx)
{
WINDOW *win;
PANEL *pan = 0;
if ((pan = new_panel(win)) == 0) {
delwin(win);
} else if (use_colors) {
- short fg = (short) ((color == COLOR_BLUE) ? COLOR_WHITE : COLOR_BLACK);
- short bg = color;
+ NCURSES_COLOR_T fg = (NCURSES_COLOR_T) ((color == COLOR_BLUE)
+ ? COLOR_WHITE
+ : COLOR_BLACK);
+ NCURSES_COLOR_T bg = color;
init_pair(color, fg, bg);
wbkgdset(win, (attr_t) (COLOR_PAIR(color) | ' '));
static void
overlap_test_1_attr(WINDOW *win, int flavor, int col)
{
- short cpair = (short) (1 + (flavor * 2) + col);
+ NCURSES_PAIRS_T cpair = (NCURSES_PAIRS_T) (1 + (flavor * 2) + col);
switch (flavor) {
case 0:
static void
overlap_test_2_attr(WINDOW *win, int flavor, int col)
{
- short cpair = (short) (9 + (flavor * 2) + col);
+ NCURSES_PAIRS_T cpair = (NCURSES_PAIRS_T) (9 + (flavor * 2) + col);
switch (flavor) {
case 0:
max_pairs = COLOR_PAIRS; /* was > 256 ? 256 : COLOR_PAIRS */
if (can_change_color()) {
- short cp;
+ NCURSES_PAIRS_T cp;
all_colors = typeMalloc(RGB_DATA, (unsigned) max_colors);
if (!all_colors)
failed("all_colors");
&& okRGB(red)
&& okRGB(green)
&& okRGB(blue)) {
- all_colors[c].red = (short) ((red * 1000) / scale);
- all_colors[c].green = (short) ((green * 1000) / scale);
- all_colors[c].blue = (short) ((blue * 1000) / scale);
+#define Scaled(n) (NCURSES_COLOR_T) (((n) * 1000) / scale)
+ all_colors[c].red = Scaled(red);
+ all_colors[c].green = Scaled(green);
+ all_colors[c].blue = Scaled(blue);
}
}
fclose(fp);
/****************************************************************************
- * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
/****************************************************************************
* Author: Thomas E. Dickey 1996-on *
****************************************************************************/
-/* $Id: test.priv.h,v 1.122 2013/10/20 00:25:18 tom Exp $ */
+/* $Id: test.priv.h,v 1.123 2014/02/01 22:09:27 tom Exp $ */
#ifndef __TEST_PRIV_H
#define __TEST_PRIV_H 1
#define NCURSES_CH_T cchar_t
#endif
+#ifndef NCURSES_COLOR_T
+#define NCURSES_COLOR_T short
+#endif
+
+#ifndef NCURSES_PAIRS_T
+#define NCURSES_PAIRS_T short
+#endif
+
#ifndef NCURSES_OPAQUE
#define NCURSES_OPAQUE 0
#endif
if ((count = getcchar(s, NULL, NULL, NULL, NULL)) > 0) { \
wchar_t test_wch[CCHARW_MAX + 2]; \
attr_t test_attrs; \
- short test_pair; \
+ NCURSES_PAIRS_T test_pair; \
\
if (getcchar( s, test_wch, &test_attrs, &test_pair, NULL) == OK \
&& test_wch[0] != L'\0') { \