Use the single define PDC_WIDE to ifdef all wide-character stuff. My

attempt to separate it from the UNICODE ifdef was quixotic... users will
just have to define PDC_WIDE for any wide-character program. The
configure parameter becomes "--enable-widec", as in ncurses.
This commit is contained in:
William McBrine
2006-07-13 00:20:27 +00:00
parent ac5a012ca1
commit 8231fdd198
11 changed files with 96 additions and 82 deletions

16
configure vendored
View File

@@ -847,7 +847,7 @@ Optional Features:
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-debug turn on debugging
--enable-latin1 include support for LATIN1 keys
--enable-unicode include support for Unicode
--enable-widec include support for wide characters
--enable-purify link with Purify (TM)
Optional Packages:
@@ -4901,15 +4901,15 @@ _ACEOF
fi
# Check whether --enable-unicode or --disable-unicode was given.
if test "${enable_unicode+set}" = set; then
enableval="$enable_unicode"
with_unicode=$enableval
# Check whether --enable-widec or --disable-widec was given.
if test "${enable_widec+set}" = set; then
enableval="$enable_widec"
with_widec=$enableval
else
with_unicode=no
with_widec=no
fi;
if test "$with_unicode" = yes; then
SYS_DEFS="$SYS_DEFS -DUNICODE"
if test "$with_widec" = yes; then
SYS_DEFS="$SYS_DEFS -DPDC_WIDE"
fi
# Check whether --enable-purify or --disable-purify was given.

View File

@@ -153,15 +153,15 @@ if test "$with_latin1" = yes; then
AC_DEFINE(INCLUDE_LATIN1)
fi
dnl ----------------- check for Unicode support ---------------------
dnl allow --enable-unicode to include Unicode support
AC_ARG_ENABLE(unicode,
[ --enable-unicode include support for Unicode],
[with_unicode=$enableval],
[with_unicode=no],
dnl --------------- check for wide character support ----------------
dnl allow --enable-widec to include wide character support
AC_ARG_ENABLE(widec,
[ --enable-widec include support for wide characters],
[with_widec=$enableval],
[with_widec=no],
)
if test "$with_unicode" = yes; then
SYS_DEFS="$SYS_DEFS -DUNICODE"
if test "$with_widec" = yes; then
SYS_DEFS="$SYS_DEFS -DPDC_WIDE"
fi
dnl ----------------- check for Purify support -----------------------

View File

@@ -15,7 +15,7 @@
* See the file maintain.er for details of the current maintainer. *
************************************************************************/
/* $Id: curses.h,v 1.192 2006/07/12 16:19:56 wmcbrine Exp $ */
/* $Id: curses.h,v 1.193 2006/07/13 00:20:25 wmcbrine Exp $ */
/*----------------------------------------------------------------------*
* PDCurses *
@@ -45,7 +45,7 @@ PDCurses portable platform definitions list:
**man-end****************************************************************/
#define PDC_BUILD 2808
#define PDC_BUILD 2809
#define PDCURSES 1 /* PDCurses-only routines */
#define XOPEN 1 /* X/Open Curses routines */
#define SYSVcurses 1 /* System V Curses routines */
@@ -330,6 +330,10 @@ typedef int _int;
/*----------------------------------------------------------------------*/
#if defined(WIN32) && defined(PDC_WIDE)
# define UNICODE
#endif
#if defined(WIN32) && defined(INCLUDE_WINDOWS_H)
# include <windows.h>
# ifdef MOUSE_MOVED
@@ -351,14 +355,14 @@ typedef int _int;
# endif
#endif
#if defined(CHTYPE_LONG) && (defined(XCURSES) || defined(WIN32))
# define PDC_WIDE
#endif
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h> /* Required by X/Open usage below */
#ifdef PDC_WIDE
# include <wchar.h>
#endif
#if defined(__cplusplus) || defined(__cplusplus__) || defined(__CPLUSPLUS)
extern "C"
{
@@ -807,7 +811,7 @@ currently used.)
/* VT100-compatible symbols -- box chars */
#if defined(PDC_WIDE) && defined(UNICODE)
#ifdef PDC_WIDE
# define ACS_ULCORNER (chtype)0x250c
# define ACS_LLCORNER (chtype)0x2514
# define ACS_URCORNER (chtype)0x2510
@@ -849,7 +853,7 @@ currently used.)
/* VT100-compatible symbols -- other */
#if defined(PDC_WIDE) && defined(UNICODE)
#ifdef PDC_WIDE
# define ACS_S1 (chtype)0x23ba
# define ACS_S9 (chtype)0x23bd
# define ACS_DIAMOND (chtype)0x2666
@@ -881,7 +885,7 @@ currently used.)
are not well-supported by most terminals. Stick to VT100 characters
for optimum portability. */
#if defined(PDC_WIDE) && defined(UNICODE)
#ifdef PDC_WIDE
# define ACS_LARROW (chtype)0x2190
# define ACS_RARROW (chtype)0x2192
# define ACS_DARROW (chtype)0x2193
@@ -913,7 +917,7 @@ currently used.)
them. Also, the definitions here aren't compatible with as many
code pages as those above. */
#if defined(PDC_WIDE) && defined(UNICODE)
#ifdef PDC_WIDE
# define ACS_S3 (chtype)0x23bb
# define ACS_S7 (chtype)0x23bc
# define ACS_LEQUAL (chtype)0x2264
@@ -1553,31 +1557,6 @@ int wvline(WINDOW *, chtype, int);
#ifdef PDC_WIDE
int addnwstr(const wchar_t *, int);
int addwstr(const wchar_t *);
int erasewchar(wchar_t *);
int innwstr(wchar_t *, int);
int ins_nwstr(const wchar_t *, int);
int ins_wstr(const wchar_t *);
int inwstr(wchar_t *);
int killwchar(wchar_t *);
int mvaddnwstr(int, int, const wchar_t *, int);
int mvaddwstr(int, int, const wchar_t *);
int mvinnwstr(int, int, wchar_t *, int);
int mvins_nwstr(int, int, const wchar_t *, int);
int mvins_wstr(int, int, const wchar_t *);
int mvinwstr(int, int, wchar_t *);
int mvwaddnwstr(WINDOW *, int, int, const wchar_t *, int);
int mvwaddwstr(WINDOW *, int, int, const wchar_t *);
int mvwinnwstr(WINDOW *, int, int, wchar_t *, int);
int mvwins_nwstr(WINDOW *, int, int, const wchar_t *, int);
int mvwins_wstr(WINDOW *, int, int, const wchar_t *);
int mvwinwstr(WINDOW *, int, int, wchar_t *);
int waddnwstr(WINDOW *, const wchar_t *, int);
int waddwstr(WINDOW *, const wchar_t *);
int winnwstr(WINDOW *, wchar_t *, int);
int wins_nwstr(WINDOW *, const wchar_t *, int);
int wins_wstr(WINDOW *, const wchar_t *);
int winwstr(WINDOW *, wchar_t *);
int add_wch(const cchar_t *);
int add_wchnstr(const cchar_t *, int);
int add_wchstr(const cchar_t *);
@@ -1586,34 +1565,54 @@ int border_set(const cchar_t *, const cchar_t *, const cchar_t *,
const cchar_t *, const cchar_t *);
int box_set(WINDOW *, const cchar_t *, const cchar_t *);
int echo_wchar(const cchar_t *);
int erasewchar(wchar_t *);
int getbkgrnd(cchar_t *);
int getcchar(const cchar_t *, wchar_t *, attr_t *, short *, void *);
int hline_set(const cchar_t *, int);
int innwstr(wchar_t *, int);
int ins_nwstr(const wchar_t *, int);
int ins_wch(const cchar_t *);
int ins_wstr(const wchar_t *);
int inwstr(wchar_t *);
int in_wch(cchar_t *);
int in_wchnstr(cchar_t *, int);
int in_wchstr(cchar_t *);
int killwchar(wchar_t *);
int mvaddnwstr(int, int, const wchar_t *, int);
int mvaddwstr(int, int, const wchar_t *);
int mvadd_wch(int, int, const cchar_t *);
int mvadd_wchnstr(int, int, const cchar_t *, int);
int mvadd_wchstr(int, int, const cchar_t *);
int mvhline_set(int, int, const cchar_t *, int);
int mvinnwstr(int, int, wchar_t *, int);
int mvins_nwstr(int, int, const wchar_t *, int);
int mvins_wch(int, int, const cchar_t *);
int mvins_wstr(int, int, const wchar_t *);
int mvinwstr(int, int, wchar_t *);
int mvin_wch(int, int, cchar_t *);
int mvin_wchnstr(int, int, cchar_t *, int);
int mvin_wchstr(int, int, cchar_t *);
int mvvline_set(int, int, const cchar_t *, int);
int mvwaddnwstr(WINDOW *, int, int, const wchar_t *, int);
int mvwaddwstr(WINDOW *, int, int, const wchar_t *);
int mvwadd_wch(WINDOW *, int, int, const cchar_t *);
int mvwadd_wchnstr(WINDOW *, int, int, const cchar_t *, int);
int mvwadd_wchstr(WINDOW *, int, int, const cchar_t *);
int mvwhline_set(WINDOW *, int, int, const cchar_t *, int);
int mvwinnwstr(WINDOW *, int, int, wchar_t *, int);
int mvwins_nwstr(WINDOW *, int, int, const wchar_t *, int);
int mvwins_wch(WINDOW *, int, int, const cchar_t *);
int mvwins_wstr(WINDOW *, int, int, const wchar_t *);
int mvwin_wch(WINDOW *, int, int, cchar_t *);
int mvwin_wchnstr(WINDOW *, int, int, cchar_t *, int);
int mvwin_wchstr(WINDOW *, int, int, cchar_t *);
int mvwinwstr(WINDOW *, int, int, wchar_t *);
int mvwvline_set(WINDOW *, int, int, const cchar_t *, int);
int pecho_wchar(WINDOW *, const cchar_t*);
int setcchar(cchar_t*, const wchar_t*, const attr_t, short, const void*);
int vline_set(const cchar_t *, int);
int waddnwstr(WINDOW *, const wchar_t *, int);
int waddwstr(WINDOW *, const wchar_t *);
int wadd_wch(WINDOW *, const cchar_t *);
int wadd_wchnstr(WINDOW *, const cchar_t *, int);
int wadd_wchstr(WINDOW *, const cchar_t *);
@@ -1625,12 +1624,33 @@ int wborder_set(WINDOW *, const cchar_t *, const cchar_t *,
int wecho_wchar(WINDOW *, const cchar_t *);
int wgetbkgrnd(WINDOW *, cchar_t *);
int whline_set(WINDOW *, const cchar_t *, int);
int winnwstr(WINDOW *, wchar_t *, int);
int wins_nwstr(WINDOW *, const wchar_t *, int);
int wins_wch(WINDOW *, const cchar_t *);
int wins_wstr(WINDOW *, const wchar_t *);
int winwstr(WINDOW *, wchar_t *);
int win_wch(WINDOW *, cchar_t *);
int win_wchnstr(WINDOW *, cchar_t *, int);
int win_wchstr(WINDOW *, cchar_t *);
wchar_t *wunctrl(cchar_t *);
int wvline_set(WINDOW *, const cchar_t *, int);
int getn_wstr(wint_t *, int);
int get_wch(wint_t *);
int get_wstr(wint_t *);
int mvgetn_wstr(int, int, wint_t *, int);
int mvget_wch(int, int, wint_t *);
int mvget_wstr(int, int, wint_t *);
int mvwgetn_wstr(WINDOW *, int, int, wint_t *, int);
int mvwget_wch(WINDOW *, int, int, wint_t *);
int mvwget_wstr(WINDOW *, int, int, wint_t *);
int wgetn_wstr(WINDOW *, wint_t *, int);
int wget_wch(WINDOW *, wint_t *);
int wget_wstr(WINDOW *, wint_t *);
char *key_name(wchar_t);
int slk_wset(int, const wchar_t *, int);
int unget_wch(const wchar_t);
#endif
/* Quasi-standard */

View File

@@ -5,7 +5,7 @@
* wrs(5/28/93) -- modified to be consistent (perform identically) with
* either PDCurses or under Unix System V, R4
*
* $Id: testcurs.c,v 1.54 2006/07/12 16:19:56 wmcbrine Exp $
* $Id: testcurs.c,v 1.55 2006/07/13 00:20:26 wmcbrine Exp $
*/
#ifdef PDCDEBUG
@@ -21,14 +21,8 @@
#include <string.h>
#include <curses.h>
#ifdef PDCURSES
# if defined(PDC_WIDE) && defined(UNICODE)
# define HAVE_WIDE 1
# endif
#else
# ifdef WACS_S1
# define HAVE_WIDE 1
# endif
#ifdef WACS_S1
# define HAVE_WIDE 1
#endif
#ifdef HAVE_WIDE

View File

@@ -39,7 +39,7 @@ CFLAGS = -N -v -y -DPDCDEBUG
CFLAGS = -O -w-par
!endif
CPPFLAGS = -I$(PDCURSES_HOME) #-DUNICODE
CPPFLAGS = -I$(PDCURSES_HOME) #-DPDC_WIDE
CCFLAGS = -c -Tpe -w32 $(CFLAGS) $(CPPFLAGS)

View File

@@ -41,7 +41,7 @@ else
LDFLAGS =
endif
CPPFLAGS = -I$(PDCURSES_HOME) #-DUNICODE
CPPFLAGS = -I$(PDCURSES_HOME) #-DPDC_WIDE
CCFLAGS = $(CFLAGS) $(CPPFLAGS)

View File

@@ -33,7 +33,7 @@ CC = lcc
#CFLAGS = -c -g3 -A -ansic
CFLAGS = -c -O -A -ansic
CPPFLAGS = -I$(PDCURSES_HOME) #-DUNICODE
CPPFLAGS = -I$(PDCURSES_HOME) #-DPDC_WIDE
CCFLAGS = $(CFLAGS) $(CPPFLAGS)
DLL_CCFLAGS = $(CFLAGS) $(CPPFLAGS) -DPDC_DLL_BUILD #-DPDC_THREAD_BUILD

View File

@@ -41,7 +41,7 @@ else
LDFLAGS =
endif
CPPFLAGS = -I$(PDCURSES_HOME) #-DUNICODE
CPPFLAGS = -I$(PDCURSES_HOME) -DPDC_WIDE
CCFLAGS = $(CFLAGS) $(CPPFLAGS)

View File

@@ -43,7 +43,7 @@ LDFLAGS =
SHL_LD = link $(LDFLAGS) /NOLOGO /DLL /OUT:curses.dll /DEF:$(osdir)\curses.def
CPPFLAGS = -I$(PDCURSES_HOME) #-DUNICODE
CPPFLAGS = -I$(PDCURSES_HOME) #-DPDC_WIDE
CCFLAGS = -c $(CFLAGS) $(CPPFLAGS)
DLL_CCFLAGS = -c $(CFLAGS) $(CPPFLAGS) -DPDC_DLL_BUILD #-MT -DPDC_THREAD_BUILD

View File

@@ -42,7 +42,7 @@ CFLAGS = /oneatx
LDFLAGS = op q sys $(TARGET)
!endif
CPPFLAGS = /i=$(PDCURSES_HOME) #/DUNICODE
CPPFLAGS = /i=$(PDCURSES_HOME) #/DPDC_WIDE
CCFLAGS = /ei /zq /wx $(CFLAGS) $(CPPFLAGS)

View File

@@ -20,7 +20,7 @@
#include <stdlib.h>
#include <string.h>
RCSID("$Id: pdcx11.c,v 1.72 2006/07/08 00:21:41 wmcbrine Exp $");
RCSID("$Id: pdcx11.c,v 1.73 2006/07/13 00:20:27 wmcbrine Exp $");
AppData app_data;
@@ -633,7 +633,7 @@ XtResource app_resources[PDC_NUMBER_APP_RESOURCES] =
XtOffsetOf(AppData, normalfont),
XtRString,
(XtPointer)
#ifdef UNICODE
#ifdef PDC_WIDE
"-misc-fixed-medium-r-normal--20-200-75-75-c-100-iso10646-1",
#else
"7x13",
@@ -648,7 +648,7 @@ XtResource app_resources[PDC_NUMBER_APP_RESOURCES] =
XtOffsetOf(AppData, italicfont),
XtRString,
(XtPointer)
#ifdef UNICODE
#ifdef PDC_WIDE
"-misc-fixed-medium-r-normal--20-200-75-75-c-100-iso10646-1",
#else
"7x13",
@@ -892,7 +892,7 @@ void dummy_function(void)
{
}
#ifdef UNICODE
#ifdef PDC_WIDE
static int to_utf8(char *outcode, int code)
{
if (code < 0x80)
@@ -983,7 +983,7 @@ static void makeXY(int x, int y, int fontwidth, int fontheight,
}
static int XCursesNewPacket(chtype attr, bool rev, int len, int col, int row,
#ifdef UNICODE
#ifdef PDC_WIDE
XChar2b *text)
#else
char *text)
@@ -1004,7 +1004,7 @@ static int XCursesNewPacket(chtype attr, bool rev, int len, int col, int row,
back = COLOR_BLACK;
}
#ifdef UNICODE
#ifdef PDC_WIDE
text[len].byte1 = 0;
text[len].byte2 = 0;
#else
@@ -1031,7 +1031,7 @@ static int XCursesNewPacket(chtype attr, bool rev, int len, int col, int row,
makeXY(col, row, XCursesFontWidth, XCursesFontHeight, &xpos, &ypos);
#ifdef UNICODE
#ifdef PDC_WIDE
XDrawImageString16(
#else
XDrawImageString(
@@ -1078,7 +1078,7 @@ static int XCursesNewPacket(chtype attr, bool rev, int len, int col, int row,
int XCursesDisplayText(const chtype *ch, int row, int col, int num_cols,
bool highlight)
{
#ifdef UNICODE
#ifdef PDC_WIDE
XChar2b text[513];
#else
char text[513];
@@ -1098,7 +1098,7 @@ int XCursesDisplayText(const chtype *ch, int row, int col, int num_cols,
{
chtype curr = ch[j];
#ifndef UNICODE
#ifndef PDC_WIDE
/* Special handling for ACS_BLOCK */
if (!(curr & A_CHARTEXT))
@@ -1120,7 +1120,7 @@ int XCursesDisplayText(const chtype *ch, int row, int col, int num_cols,
i = 0;
}
#ifdef UNICODE
#ifdef PDC_WIDE
text[i].byte1 = (curr & 0xff00) >> 8;
text[i++].byte2 = curr & 0x00ff;
#else
@@ -1857,7 +1857,7 @@ Boolean XCursesConvertProc(Widget w, Atom *selection, Atom *target,
&std_length, format_return);
*length_return = std_length +
#ifdef UNICODE
#ifdef PDC_WIDE
2;
#else
1;
@@ -1866,7 +1866,7 @@ Boolean XCursesConvertProc(Widget w, Atom *selection, Atom *target,
targetP = *(Atom**)value_return;
*targetP++ = XA_STRING;
#ifdef UNICODE
#ifdef PDC_WIDE
*targetP++ = XA_UTF8_STRING(XtDisplay(topLevel));
#endif
@@ -1880,16 +1880,16 @@ Boolean XCursesConvertProc(Widget w, Atom *selection, Atom *target,
return True;
}
else if (
#ifdef UNICODE
#ifdef PDC_WIDE
*target == XA_UTF8_STRING(XtDisplay(topLevel)) ||
#endif
*target == XA_STRING)
{
#ifdef UNICODE
#ifdef PDC_WIDE
bool utf8 = (*target == XA_UTF8_STRING(XtDisplay(topLevel)));
#endif
char *data = XtMalloc(tmpsel_length
#ifdef UNICODE
#ifdef PDC_WIDE
* 3
#endif
+ 1);
@@ -1897,7 +1897,7 @@ Boolean XCursesConvertProc(Widget w, Atom *selection, Atom *target,
chtype *tmp = tmpsel;
int ret_length = 0;
#ifdef UNICODE
#ifdef PDC_WIDE
if (utf8)
{
while (*tmp)