Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/curses-v3]: src/lib/libcurses Add alternate character set support.
details: https://anonhg.NetBSD.org/src/rev/976d20237320
branches: curses-v3
changeset: 479965:976d20237320
user: jdc <jdc%NetBSD.org@localhost>
date: Sun Mar 05 23:25:17 2000 +0000
description:
Add alternate character set support.
diffstat:
lib/libcurses/addbytes.c | 10 ++++++++--
lib/libcurses/curses.c | 18 +++++++++---------
lib/libcurses/initscr.c | 6 ++++--
lib/libcurses/refresh.c | 34 +++++++++++++++++++++++++++++++---
lib/libcurses/setterm.c | 44 +++++++++++++++++++++++---------------------
5 files changed, 75 insertions(+), 37 deletions(-)
diffs (257 lines):
diff -r 67be39702a8c -r 976d20237320 lib/libcurses/addbytes.c
--- a/lib/libcurses/addbytes.c Sun Mar 05 23:22:16 2000 +0000
+++ b/lib/libcurses/addbytes.c Sun Mar 05 23:25:17 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: addbytes.c,v 1.14.6.1 2000/01/09 20:43:17 jdc Exp $ */
+/* $NetBSD: addbytes.c,v 1.14.6.2 2000/03/05 23:25:17 jdc Exp $ */
/*
* Copyright (c) 1987, 1993, 1994
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)addbytes.c 8.4 (Berkeley) 5/4/94";
#else
-__RCSID("$NetBSD: addbytes.c,v 1.14.6.1 2000/01/09 20:43:17 jdc Exp $");
+__RCSID("$NetBSD: addbytes.c,v 1.14.6.2 2000/03/05 23:25:17 jdc Exp $");
#endif
#endif /* not lint */
@@ -121,6 +121,8 @@
attributes |= __BLANK;
if (win->wattr & __PROTECT || attr & __PROTECT)
attributes |= __PROTECT;
+ if (win->wattr & __ALTCHARSET || attr & __ALTCHARSET)
+ attributes |= __ALTCHARSET;
#ifdef DEBUG
__CTRACE("ADDBYTES: 1: y = %d, x = %d, firstch = %d, lastch = %d\n",
y, x, *win->lines[y]->firstchp,
@@ -178,6 +180,10 @@
lp->line[x].attr |= __PROTECT;
else
lp->line[x].attr &= ~__PROTECT;
+ if (attributes & __ALTCHARSET)
+ lp->line[x].attr |= __ALTCHARSET;
+ else
+ lp->line[x].attr &= ~__ALTCHARSET;
if (x == win->maxx - 1)
lp->flags |= __ISPASTEOL;
else
diff -r 67be39702a8c -r 976d20237320 lib/libcurses/curses.c
--- a/lib/libcurses/curses.c Sun Mar 05 23:22:16 2000 +0000
+++ b/lib/libcurses/curses.c Sun Mar 05 23:25:17 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: curses.c,v 1.11 1999/06/28 13:32:43 simonb Exp $ */
+/* $NetBSD: curses.c,v 1.11.6.1 2000/03/05 23:25:17 jdc Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)curses.c 8.3 (Berkeley) 5/4/94";
#else
-__RCSID("$NetBSD: curses.c,v 1.11 1999/06/28 13:32:43 simonb Exp $");
+__RCSID("$NetBSD: curses.c,v 1.11.6.1 2000/03/05 23:25:17 jdc Exp $");
#endif
#endif /* not lint */
@@ -55,13 +55,13 @@
*/
char AM, BS, CA, DA, EO, HC, IN, MI, MS, NC, NS, OS, PC, UL, XB, XN,
XT, XS, XX;
-char *AL, *BC, *BL, *BT, *CD, *CE, *CL, *CM, *CR, *CS, *DC, *DL, *DM,
- *DO, *ED, *EI, *K0, *K1, *K2, *K3, *K4, *K5, *K6, *K7, *K8, *K9,
- *HO, *IC, *IM, *IP, *KD, *KE, *KH, *KL, *KR, *KS, *KU, *LL, *MA,
- *MB, *MD, *ME, *MH, *MK, *MP, *MR, *ND, *NL, *RC, *SC, *SE, *SF,
- *SO, *SR, *TA, *TE, *TI, *UC, *UE, *UP, *US, *VB, *VS, *VE, *al,
- *dl, *sf, *sr, *AL_PARM, *DL_PARM, *UP_PARM, *DOWN_PARM, *LEFT_PARM,
- *RIGHT_PARM;
+char *AC, *AE, *AL, *AS, *BC, *BL, *BT, *CD, *CE, *CL, *CM, *CR, *CS,
+ *DC, *DL, *DM, *DO, *Ea, *ED, *EI, *K0, *K1, *K2, *K3, *K4, *K5,
+ *K6, *K7, *K8, *K9, *HO, *IC, *IM, *IP, *KD, *KE, *KH, *KL, *KR,
+ *KS, *KU, *LL, *MA, *MB, *MD, *ME, *MH, *MK, *MP, *MR, *ND, *NL,
+ *RC, *SC, *SE, *SF, *SO, *SR, *TA, *TE, *TI, *UC, *UE, *UP, *US,
+ *VB, *VS, *VE, *al, *dl, *sf, *sr, *AL_PARM, *DL_PARM, *UP_PARM,
+ *DOWN_PARM, *LEFT_PARM, *RIGHT_PARM;
/*
* Public.
*
diff -r 67be39702a8c -r 976d20237320 lib/libcurses/initscr.c
--- a/lib/libcurses/initscr.c Sun Mar 05 23:22:16 2000 +0000
+++ b/lib/libcurses/initscr.c Sun Mar 05 23:25:17 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: initscr.c,v 1.11 1999/06/28 13:32:43 simonb Exp $ */
+/* $NetBSD: initscr.c,v 1.11.6.1 2000/03/05 23:25:17 jdc Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)initscr.c 8.2 (Berkeley) 5/4/94";
#else
-__RCSID("$NetBSD: initscr.c,v 1.11 1999/06/28 13:32:43 simonb Exp $");
+__RCSID("$NetBSD: initscr.c,v 1.11.6.1 2000/03/05 23:25:17 jdc Exp $");
#endif
#endif /* not lint */
@@ -93,6 +93,8 @@
__init_getch(sp);
+ __init_acs();
+
__set_stophandler();
#ifdef DEBUG
diff -r 67be39702a8c -r 976d20237320 lib/libcurses/refresh.c
--- a/lib/libcurses/refresh.c Sun Mar 05 23:22:16 2000 +0000
+++ b/lib/libcurses/refresh.c Sun Mar 05 23:25:17 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: refresh.c,v 1.14.6.1 2000/01/09 20:43:21 jdc Exp $ */
+/* $NetBSD: refresh.c,v 1.14.6.2 2000/03/05 23:25:17 jdc Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)refresh.c 8.7 (Berkeley) 8/13/94";
#else
-__RCSID("$NetBSD: refresh.c,v 1.14.6.1 2000/01/09 20:43:21 jdc Exp $");
+__RCSID("$NetBSD: refresh.c,v 1.14.6.2 2000/03/05 23:25:17 jdc Exp $");
#endif
#endif /* not lint */
@@ -353,6 +353,10 @@
tputs(ME, 0, __cputchar);
curscr->wattr &= ~__TERMATTR;
}
+ if (curscr->wattr & __ALTCHARSET) {
+ tputs(AE, 0, __cputchar);
+ curscr->wattr &= ~__ALTCHARSET;
+ }
tputs(CE, 0, __cputchar);
lx = wx + win->begx;
while (wx++ <= clsp) {
@@ -493,6 +497,20 @@
}
}
+ /* Enter/exit altcharset mode as appropriate. */
+ if (nsp->attr & __ALTCHARSET) {
+ if (!(curscr->wattr & __ALTCHARSET) &&
+ AS != NULL && AE != NULL) {
+ tputs(AS, 0, __cputchar);
+ curscr->wattr |= __ALTCHARSET;
+ }
+ } else {
+ if (curscr->wattr & __ALTCHARSET) {
+ tputs(AE, 0, __cputchar);
+ curscr->wattr &= ~__ALTCHARSET;
+ }
+ }
+
wx++;
if (wx >= win->maxx && wy == win->maxy - 1 && !curwin)
if (win->flags & __SCROLLOK) {
@@ -607,12 +625,18 @@
tputs(ME, 0, __cputchar);
curscr->wattr &= ~__TERMATTR;
}
+ /* Don't leave the screen with altcharset set. */
+ if (curscr->wattr & __ALTCHARSET) {
+ tputs(AE, 0, __cputchar);
+ curscr->wattr &= ~__ALTCHARSET;
+ }
return (OK);
}
/*
* domvcur --
- * Do a mvcur, leaving standout and attribute modes if necessary.
+ * Do a mvcur, leaving standout, attribute and altcharset modes if
+ * necessary.
*/
static void
domvcur(oy, ox, ny, nx)
@@ -636,6 +660,10 @@
tputs(ME, 0, __cputchar);
curscr->wattr &= ~__TERMATTR;
}
+ if (curscr->wattr & __ALTCHARSET) {
+ tputs(AE, 0, __cputchar);
+ curscr->wattr &= ~__ALTCHARSET;
+ }
__mvcur(oy, ox, ny, nx, 1);
}
diff -r 67be39702a8c -r 976d20237320 lib/libcurses/setterm.c
--- a/lib/libcurses/setterm.c Sun Mar 05 23:22:16 2000 +0000
+++ b/lib/libcurses/setterm.c Sun Mar 05 23:25:17 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: setterm.c,v 1.13.2.1 2000/01/09 20:43:22 jdc Exp $ */
+/* $NetBSD: setterm.c,v 1.13.2.2 2000/03/05 23:25:17 jdc Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)setterm.c 8.8 (Berkeley) 10/25/94";
#else
-__RCSID("$NetBSD: setterm.c,v 1.13.2.1 2000/01/09 20:43:22 jdc Exp $");
+__RCSID("$NetBSD: setterm.c,v 1.13.2.2 2000/03/05 23:25:17 jdc Exp $");
#endif
#endif /* not lint */
@@ -62,24 +62,26 @@
static char *_PC,
**sstrs[] = {
- /* AL bc bl bt cd ce cl cm cr */
- &AL, &BC, &BL, &BT, &CD, &CE, &CL, &CM, &CR,
- /* cs dc DL dm do ed ei k0 k1 */
- &CS, &DC, &DL, &DM, &DO, &ED, &EI, &K0, &K1,
- /* k2 k3 k4 k5 k6 k7 k8 k9 ho */
- &K2, &K3, &K4, &K5, &K6, &K7, &K8, &K9, &HO,
- /* ic im ip kd ke kh kl kr ks */
- &IC, &IM, &IP, &KD, &KE, &KH, &KL, &KR, &KS,
- /* ku ll ma mb md me mh mk mp */
- &KU, &LL, &MA, &MB, &MD, &ME, &MH, &MK, &MP,
- /* mr nd nl pc rc sc se SF so */
- &MR, &ND, &NL, &_PC, &RC, &SC, &SE, &SF, &SO,
- /* SR ta te ti uc ue up us vb */
- &SR, &TA, &TE, &TI, &UC, &UE, &UP, &US, &VB,
- /* vs ve al dl sf sr AL DL */
- &VS, &VE, &al, &dl, &sf, &sr, &AL_PARM, &DL_PARM,
- /* UP DO LE RI */
- &UP_PARM, &DOWN_PARM, &LEFT_PARM, &RIGHT_PARM,
+ /* AC AE AL AS bc bl bt cd ce */
+ &AC, &AE, &AL, &AS, &BC, &BL, &BT, &CD, &CE,
+ /* cl cm cr cs dc DL dm do eA */
+ &CL, &CM, &CR, &CS, &DC, &DL, &DM, &DO, &Ea,
+ /* ed ei k0 k1 k2 k3 k4 k5 k6 */
+ &ED, &EI, &K0, &K1, &K2, &K3, &K4, &K5, &K6,
+ /* k7 k8 k9 ho ic im ip kd ke */
+ &K7, &K8, &K9, &HO, &IC, &IM, &IP, &KD, &KE,
+ /* kh kl kr ks ku ll ma mb md */
+ &KH, &KL, &KR, &KS, &KU, &LL, &MA, &MB, &MD,
+ /* me mh mk mp mr nd nl pc rc */
+ &ME, &MH, &MK, &MP, &MR, &ND, &NL, &_PC, &RC,
+ /* sc se SF so SR ta te ti uc */
+ &SC, &SE, &SF, &SO, &SR, &TA, &TE, &TI, &UC,
+ /* ue up us vb vs ve al dl sf */
+ &UE, &UP, &US, &VB, &VS, &VE, &al, &dl, &sf,
+ /* sr AL DL UP DO */
+ &sr, &AL_PARM, &DL_PARM, &UP_PARM, &DOWN_PARM,
+ /* LE RI */
+ &LEFT_PARM, &RIGHT_PARM,
};
static char *aoftspace; /* Address of _tspace for relocation */
@@ -198,7 +200,7 @@
namp += 2;
} while (*namp);
- namp = "ALbcblbtcdceclcmcrcsdcDLdmdoedeik0k1k2k3k4k5k6k7k8k9hoicimipkdkekhklkrkskullmambmdmemhmkmpmrndnlpcrcscseSFsoSRtatetiucueupusvbvsvealdlsfsrALDLUPDOLERI";
+ namp = "acaeALasbcblbtcdceclcmcrcsdcDLdmdoeAedeik0k1k2k3k4k5k6k7k8k9hoicimipkdkekhklkrkskullmambmdmemhmkmpmrndnlpcrcscseSFsoSRtatetiucueupusvbvsvealdlsfsrALDLUPDOLERI";
sp = sstrs;
do {
*tmp = *namp;
Home |
Main Index |
Thread Index |
Old Index