Added a new table, pdc_acs[], and moved the definitions to the platform

directories. Pros: Uses the correct (Unicode) values when PDC_WIDE is
set when compiling the library, but not the executable; better platform
separation; smaller curses.h; allows run-time redefinition of ACS_*
values; more like other curses implementations. Cons: The table is
duplicated in DOS, OS/2 and Win32. I used pdc_acs[], rather than the
traditional acs_map[], because the traditional acs_map[] is mostly
unused space, and because I don't really want to encourage direct
references to this table. This may not be the final form.
This commit is contained in:
William McBrine
2006-09-20 07:36:04 +00:00
parent 781bec97ad
commit 5dcc97bf35
6 changed files with 113 additions and 134 deletions

157
curses.h
View File

@@ -15,7 +15,7 @@
* See the file maintain.er for details of the current maintainer. *
************************************************************************/
/* $Id: curses.h,v 1.221 2006/09/20 06:42:03 wmcbrine Exp $ */
/* $Id: curses.h,v 1.222 2006/09/20 07:36:03 wmcbrine Exp $ */
/*----------------------------------------------------------------------*
* PDCurses *
@@ -743,144 +743,55 @@ currently used.)
/*** Alternate character set macros ***/
/* Non-X/Unicode definitions are from jshumate@wrdis01.robins.af.mil --
these match code page 437 and compatible pages (CP850, CP852, etc.) */
extern chtype pdc_acs[];
/* VT100-compatible symbols -- box chars */
#ifdef PDC_WIDE
# define ACS_ULCORNER (chtype)0x250c
# define ACS_LLCORNER (chtype)0x2514
# define ACS_URCORNER (chtype)0x2510
# define ACS_LRCORNER (chtype)0x2518
# define ACS_RTEE (chtype)0x2524
# define ACS_LTEE (chtype)0x251c
# define ACS_BTEE (chtype)0x2534
# define ACS_TTEE (chtype)0x252c
# define ACS_HLINE (chtype)0x2500
# define ACS_VLINE (chtype)0x2502
# define ACS_PLUS (chtype)0x253c
#else
# ifdef XCURSES
# define ACS_ULCORNER ((chtype)13 | A_ALTCHARSET)
# define ACS_LLCORNER ((chtype)14 | A_ALTCHARSET)
# define ACS_URCORNER ((chtype)12 | A_ALTCHARSET)
# define ACS_LRCORNER ((chtype)11 | A_ALTCHARSET)
# define ACS_RTEE ((chtype)22 | A_ALTCHARSET)
# define ACS_LTEE ((chtype)21 | A_ALTCHARSET)
# define ACS_BTEE ((chtype)23 | A_ALTCHARSET)
# define ACS_TTEE ((chtype)24 | A_ALTCHARSET)
# define ACS_HLINE ((chtype)18 | A_ALTCHARSET)
# define ACS_VLINE ((chtype)25 | A_ALTCHARSET)
# define ACS_PLUS ((chtype)15 | A_ALTCHARSET)
# else
# define ACS_ULCORNER (chtype)0xda
# define ACS_LLCORNER (chtype)0xc0
# define ACS_URCORNER (chtype)0xbf
# define ACS_LRCORNER (chtype)0xd9
# define ACS_RTEE (chtype)0xb4
# define ACS_LTEE (chtype)0xc3
# define ACS_BTEE (chtype)0xc1
# define ACS_TTEE (chtype)0xc2
# define ACS_HLINE (chtype)0xc4
# define ACS_VLINE (chtype)0xb3
# define ACS_PLUS (chtype)0xc5
# endif
#endif
#define ACS_ULCORNER (pdc_acs[0])
#define ACS_LLCORNER (pdc_acs[1])
#define ACS_URCORNER (pdc_acs[2])
#define ACS_LRCORNER (pdc_acs[3])
#define ACS_RTEE (pdc_acs[4])
#define ACS_LTEE (pdc_acs[5])
#define ACS_BTEE (pdc_acs[6])
#define ACS_TTEE (pdc_acs[7])
#define ACS_HLINE (pdc_acs[8])
#define ACS_VLINE (pdc_acs[9])
#define ACS_PLUS (pdc_acs[10])
/* VT100-compatible symbols -- other */
#ifdef PDC_WIDE
# define ACS_S1 (chtype)0x23ba
# define ACS_S9 (chtype)0x23bd
# define ACS_DIAMOND (chtype)0x2666
# define ACS_CKBOARD (chtype)0x2592
# define ACS_DEGREE (chtype)0x00b0
# define ACS_PLMINUS (chtype)0x00b1
# define ACS_BULLET (chtype)0x00b7
#else
# ifdef XCURSES
# define ACS_S1 ((chtype)16 | A_ALTCHARSET)
# define ACS_S9 ((chtype)20 | A_ALTCHARSET)
# define ACS_DIAMOND ((chtype)1 | A_ALTCHARSET)
# define ACS_CKBOARD ((chtype)2 | A_ALTCHARSET)
# define ACS_DEGREE ((chtype)7 | A_ALTCHARSET)
# define ACS_PLMINUS ((chtype)8 | A_ALTCHARSET)
# define ACS_BULLET (chtype)'*'
# else
# define ACS_S1 (chtype)0x2d
# define ACS_S9 (chtype)0x5f
# define ACS_DIAMOND ((chtype)0x04 | A_ALTCHARSET)
# define ACS_CKBOARD (chtype)0xb1
# define ACS_DEGREE (chtype)0xf8
# define ACS_PLMINUS (chtype)0xf1
# define ACS_BULLET (chtype)0xf9
# endif
#endif
#define ACS_S1 (pdc_acs[11])
#define ACS_S9 (pdc_acs[12])
#define ACS_DIAMOND (pdc_acs[13])
#define ACS_CKBOARD (pdc_acs[14])
#define ACS_DEGREE (pdc_acs[15])
#define ACS_PLMINUS (pdc_acs[16])
#define ACS_BULLET (pdc_acs[17])
/* Teletype 5410v1 symbols -- these are defined in SysV curses, but
are not well-supported by most terminals. Stick to VT100 characters
for optimum portability. */
#ifdef PDC_WIDE
# define ACS_LARROW (chtype)0x2190
# define ACS_RARROW (chtype)0x2192
# define ACS_DARROW (chtype)0x2193
# define ACS_UARROW (chtype)0x2191
# define ACS_BOARD (chtype)0x2591
# define ACS_LANTERN (chtype)0x00a4
# define ACS_BLOCK (chtype)0x2588
#else
# ifdef XCURSES
# define ACS_LARROW (chtype)'<'
# define ACS_RARROW (chtype)'>'
# define ACS_DARROW (chtype)'v'
# define ACS_UARROW (chtype)'^'
# define ACS_BOARD (chtype)'#'
# define ACS_LANTERN (chtype)'#'
# define ACS_BLOCK ((chtype)0 | A_ALTCHARSET)
# else
# define ACS_LARROW ((chtype)0x1b | A_ALTCHARSET)
# define ACS_RARROW ((chtype)0x1a | A_ALTCHARSET)
# define ACS_DARROW ((chtype)0x19 | A_ALTCHARSET)
# define ACS_UARROW ((chtype)0x18 | A_ALTCHARSET)
# define ACS_BOARD (chtype)0xb0
# define ACS_LANTERN ((chtype)0x0f | A_ALTCHARSET)
# define ACS_BLOCK (chtype)0xdb
# endif
#endif
#define ACS_LARROW (pdc_acs[18])
#define ACS_RARROW (pdc_acs[19])
#define ACS_DARROW (pdc_acs[20])
#define ACS_UARROW (pdc_acs[21])
#define ACS_BOARD (pdc_acs[22])
#define ACS_LANTERN (pdc_acs[23])
#define ACS_BLOCK (pdc_acs[24])
/* That goes double for these -- undocumented SysV symbols. Don't use
them. Also, the definitions here aren't compatible with as many
code pages as those above. */
#ifdef PDC_WIDE
# define ACS_S3 (chtype)0x23bb
# define ACS_S7 (chtype)0x23bc
# define ACS_LEQUAL (chtype)0x2264
# define ACS_GEQUAL (chtype)0x2265
# define ACS_PI (chtype)0x03c0
# define ACS_NEQUAL (chtype)0x2260
# define ACS_STERLING (chtype)0x00a3
#else
# ifdef XCURSES
# define ACS_S3 ((chtype)17 | A_ALTCHARSET)
# define ACS_S7 ((chtype)19 | A_ALTCHARSET)
# define ACS_LEQUAL ((chtype)26 | A_ALTCHARSET)
# define ACS_GEQUAL ((chtype)27 | A_ALTCHARSET)
# define ACS_PI ((chtype)28 | A_ALTCHARSET)
# define ACS_NEQUAL ((chtype)29 | A_ALTCHARSET)
# define ACS_STERLING ((chtype)30 | A_ALTCHARSET)
# else
# define ACS_S3 (chtype)0x2d
# define ACS_S7 (chtype)0x2d
# define ACS_LEQUAL (chtype)0xf3
# define ACS_GEQUAL (chtype)0xf2
# define ACS_PI (chtype)0xe3
# define ACS_NEQUAL (chtype)0xd8
# define ACS_STERLING (chtype)0x9c
# endif
#endif
#define ACS_S3 (pdc_acs[25])
#define ACS_S7 (pdc_acs[26])
#define ACS_LEQUAL (pdc_acs[27])
#define ACS_GEQUAL (pdc_acs[28])
#define ACS_PI (pdc_acs[29])
#define ACS_NEQUAL (pdc_acs[30])
#define ACS_STERLING (pdc_acs[31])
/* Box char aliases */

View File

@@ -24,7 +24,21 @@
# include <sys/movedata.h>
#endif
RCSID("$Id: pdcscrn.c,v 1.51 2006/08/18 20:11:05 wmcbrine Exp $");
RCSID("$Id: pdcscrn.c,v 1.52 2006/09/20 07:36:03 wmcbrine Exp $");
/* Definitions for ACS_ULCORNER through ACS_STERLING, in the order
listed in curses.h, from jshumate@wrdis01.robins.af.mil -- these
match code page 437 and compatible pages (CP850, CP852, etc.) */
chtype pdc_acs[] =
{
0xda, 0xc0, 0xbf, 0xd9, 0xb4, 0xc3, 0xc1, 0xc2, 0xc4, 0xb3,
0xc5, 0x2d, 0x5f, (0x04 | A_ALTCHARSET), 0xb1, 0xf8, 0xf1, 0xf9,
(0x1b | A_ALTCHARSET), (0x1a | A_ALTCHARSET),
(0x19 | A_ALTCHARSET), (0x18 | A_ALTCHARSET), 0xb0,
(0x0f | A_ALTCHARSET), 0xdb, 0x2d, 0x2d, 0xf3, 0xf2, 0xe3, 0xd8,
0x9c
};
int pdc_adapter; /* screen type */
int pdc_scrnmode; /* default screen mode */

View File

@@ -25,7 +25,21 @@
#include <curses.h>
#include <stdlib.h>
RCSID("$Id: pdcscrn.c,v 1.46 2006/08/18 20:02:04 wmcbrine Exp $");
RCSID("$Id: pdcscrn.c,v 1.47 2006/09/20 07:36:03 wmcbrine Exp $");
/* Definitions for ACS_ULCORNER through ACS_STERLING, in the order
listed in curses.h, from jshumate@wrdis01.robins.af.mil -- these
match code page 437 and compatible pages (CP850, CP852, etc.) */
chtype pdc_acs[] =
{
0xda, 0xc0, 0xbf, 0xd9, 0xb4, 0xc3, 0xc1, 0xc2, 0xc4, 0xb3,
0xc5, 0x2d, 0x5f, (0x04 | A_ALTCHARSET), 0xb1, 0xf8, 0xf1, 0xf9,
(0x1b | A_ALTCHARSET), (0x1a | A_ALTCHARSET),
(0x19 | A_ALTCHARSET), (0x18 | A_ALTCHARSET), 0xb0,
(0x0f | A_ALTCHARSET), 0xdb, 0x2d, 0x2d, 0xf3, 0xf2, 0xe3, 0xd8,
0x9c
};
int pdc_font; /* default font size */

View File

@@ -23,7 +23,7 @@
#undef isendwin
#undef is_termresized
RCSID("$Id: initscr.c,v 1.74 2006/09/20 06:42:03 wmcbrine Exp $");
RCSID("$Id: initscr.c,v 1.75 2006/09/20 07:36:03 wmcbrine Exp $");
const char *_curses_notice = "PDCurses 3.0 - Public Domain 2006";
@@ -38,14 +38,17 @@ int TABSIZE = 8;
MOUSE_STATUS Mouse_status, pdc_mouse_status;
#ifdef PDC_WIDE
/* Unicode definitions for WACS_ULCORNER through WACS_STERLING, in the
order listed in curses.h */
cchar_t pdc_wacs[] = {
ACS_ULCORNER, ACS_LLCORNER, ACS_URCORNER, ACS_LRCORNER,
ACS_RTEE, ACS_LTEE, ACS_BTEE, ACS_TTEE, ACS_HLINE, ACS_VLINE,
ACS_PLUS, ACS_S1, ACS_S9, ACS_DIAMOND, ACS_CKBOARD, ACS_DEGREE,
ACS_PLMINUS, ACS_BULLET, ACS_LARROW, ACS_RARROW, ACS_DARROW,
ACS_UARROW, ACS_BOARD, ACS_LANTERN, ACS_BLOCK, ACS_S3, ACS_S7,
ACS_LEQUAL, ACS_GEQUAL, ACS_PI, ACS_NEQUAL, ACS_STERLING
0x250c, 0x2514, 0x2510, 0x2518, 0x2524, 0x251c, 0x2534, 0x252c,
0x2500, 0x2502, 0x253c, 0x23ba, 0x23bd, 0x2666, 0x2592, 0x00b0,
0x00b1, 0x00b7, 0x2190, 0x2192, 0x2193, 0x2191, 0x2591, 0x00a4,
0x2588, 0x23bb, 0x23bc, 0x2264, 0x2265, 0x03c0, 0x2260, 0x00a3
};
#endif
extern RIPPEDOFFLINE linesripped[5];
@@ -226,6 +229,13 @@ WINDOW *Xinitscr(int argc, char *argv[])
PDC_init_atrtab(); /* set up default colors */
#ifdef PDC_WIDE
/* Set the ACS_* table to the same values WACS_* */
for (i = 0; i < 32; i++)
pdc_acs[i] = pdc_wacs[i];
#endif
MOUSE_X_POS = MOUSE_Y_POS = (-1);
BUTTON_STATUS(1) = BUTTON_RELEASED;
BUTTON_STATUS(2) = BUTTON_RELEASED;

View File

@@ -24,7 +24,21 @@
#define CURSES_LIBRARY 1
#include <curses.h>
RCSID("$Id: pdcscrn.c,v 1.57 2006/08/20 06:57:56 wmcbrine Exp $");
RCSID("$Id: pdcscrn.c,v 1.58 2006/09/20 07:36:04 wmcbrine Exp $");
/* Definitions for ACS_ULCORNER through ACS_STERLING, in the order
listed in curses.h, from jshumate@wrdis01.robins.af.mil -- these
match code page 437 and compatible pages (CP850, CP852, etc.) */
chtype pdc_acs[] =
{
0xda, 0xc0, 0xbf, 0xd9, 0xb4, 0xc3, 0xc1, 0xc2, 0xc4, 0xb3,
0xc5, 0x2d, 0x5f, (0x04 | A_ALTCHARSET), 0xb1, 0xf8, 0xf1, 0xf9,
(0x1b | A_ALTCHARSET), (0x1a | A_ALTCHARSET),
(0x19 | A_ALTCHARSET), (0x18 | A_ALTCHARSET), 0xb0,
(0x0f | A_ALTCHARSET), 0xdb, 0x2d, 0x2d, 0xf3, 0xf2, 0xe3, 0xd8,
0x9c
};
#define PDC_RESTORE_NONE 0
#define PDC_RESTORE_BUFFER 1

View File

@@ -17,7 +17,23 @@
#include "pdcx11.h"
RCSID("$Id: pdcscrn.c,v 1.39 2006/08/21 04:29:46 wmcbrine Exp $");
RCSID("$Id: pdcscrn.c,v 1.40 2006/09/20 07:36:04 wmcbrine Exp $");
/* Definitions for ACS_ULCORNER through ACS_STERLING, in the order
listed in curses.h */
chtype pdc_acs[] =
{
(13 | A_ALTCHARSET), (14 | A_ALTCHARSET), (12 | A_ALTCHARSET),
(11 | A_ALTCHARSET), (22 | A_ALTCHARSET), (21 | A_ALTCHARSET),
(23 | A_ALTCHARSET), (24 | A_ALTCHARSET), (18 | A_ALTCHARSET),
(25 | A_ALTCHARSET), (15 | A_ALTCHARSET), (16 | A_ALTCHARSET),
(20 | A_ALTCHARSET), (1 | A_ALTCHARSET), (2 | A_ALTCHARSET),
(7 | A_ALTCHARSET), (8 | A_ALTCHARSET), '*', '<', '>', 'v', '^',
'#', '#', (0 | A_ALTCHARSET), (17 | A_ALTCHARSET),
(19 | A_ALTCHARSET), (26 | A_ALTCHARSET), (27 | A_ALTCHARSET),
(28 | A_ALTCHARSET), (29 | A_ALTCHARSET), (30 | A_ALTCHARSET)
};
/*man-start**************************************************************