-/* $OpenBSD: wsemul_vt100.c,v 1.41 2023/01/12 20:13:28 miod Exp $ */
+/* $OpenBSD: wsemul_vt100.c,v 1.42 2023/01/12 20:39:37 nicm Exp $ */
/* $NetBSD: wsemul_vt100.c,v 1.13 2000/04/28 21:56:16 mycroft Exp $ */
/*
edp->kernattr = defattr;
edp->tabs = NULL;
+#ifdef HAVE_DOUBLE_WIDTH_HEIGHT
edp->dblwid = NULL;
edp->dw = 0;
+#endif
edp->dcsarg = 0;
edp->isolatin1tab = edp->decgraphtab = edp->dectechtab = NULL;
edp->nrctab = NULL;
edp->cbcookie = cbcookie;
edp->tabs = malloc(edp->ncols, M_DEVBUF, M_NOWAIT);
+#ifdef HAVE_DOUBLE_WIDTH_HEIGHT
edp->dblwid = malloc(edp->nrows, M_DEVBUF, M_NOWAIT | M_ZERO);
edp->dw = 0;
+#endif
edp->dcsarg = malloc(DCS_MAXLEN, M_DEVBUF, M_NOWAIT);
edp->isolatin1tab = malloc(128 * sizeof(u_int), M_DEVBUF, M_NOWAIT);
edp->decgraphtab = malloc(128 * sizeof(u_int), M_DEVBUF, M_NOWAIT);
*ccolp = edp->ccol;
#define f(ptr) do { free(ptr, M_DEVBUF, 0); ptr = NULL; } while (0)
f(edp->tabs);
+#ifdef HAVE_DOUBLE_WIDTH_HEIGHT
f(edp->dblwid);
+#endif
f(edp->dcsarg);
f(edp->isolatin1tab);
f(edp->decgraphtab);
}
}
+#ifdef HAVE_DOUBLE_WIDTH_HEIGHT
WSEMULOP(rc, edp, &edp->abortstate, putchar,
(edp->emulcookie, edp->crow, edp->ccol << edp->dw, dc,
kernel ? edp->kernattr : edp->curattr));
+#else
+ WSEMULOP(rc, edp, &edp->abortstate, putchar,
+ (edp->emulcookie, edp->crow, edp->ccol, dc,
+ kernel ? edp->kernattr : edp->curattr));
+#endif
if (rc != 0) {
/* undo potential sschartab update */
edp->sschartab = oldsschartab;
wsemul_vt100_output_esc_hash(struct wsemul_vt100_emuldata *edp,
struct wsemul_inputstate *instate)
{
- int i;
int rc = 0;
switch (instate->inchar) {
case '5': /* DECSWL single width, single height */
+#ifdef HAVE_DOUBLE_WIDTH_HEIGHT
if (edp->dblwid != NULL && edp->dw != 0) {
+ int i;
for (i = 0; i < edp->ncols / 2; i++) {
WSEMULOP(rc, edp, &edp->abortstate, copycols,
(edp->emulcookie, edp->crow, 2 * i, i, 1));
edp->dblwid[edp->crow] = 0;
edp->dw = 0;
}
+#endif
break;
case '6': /* DECDWL double width, single height */
case '3': /* DECDHL double width, double height, top half */
case '4': /* DECDHL double width, double height, bottom half */
+#ifdef HAVE_DOUBLE_WIDTH_HEIGHT
if (edp->dblwid != NULL && edp->dw == 0) {
+ int i;
for (i = edp->ncols / 2 - 1; i >= 0; i--) {
WSEMULOP(rc, edp, &edp->abortstate, copycols,
(edp->emulcookie, edp->crow, i, 2 * i, 1));
if (edp->ccol > (edp->ncols >> 1) - 1)
edp->ccol = (edp->ncols >> 1) - 1;
}
+#endif
break;
case '8': { /* DECALN */
int i, j;
if (edp->flags & VTFL_CURSORON) {
rc = (*edp->emulops->cursor)
(edp->emulcookie, 0, edp->crow,
+#ifdef HAVE_DOUBLE_WIDTH_HEIGHT
edp->ccol << edp->dw);
+#else
+ edp->ccol);
+#endif
if (rc != 0)
return 0;
}
if (edp->flags & VTFL_CURSORON) {
rc = (*edp->emulops->cursor)
(edp->emulcookie, 1, edp->crow,
+#ifdef HAVE_DOUBLE_WIDTH_HEIGHT
edp->ccol << edp->dw);
+#else
+ edp->ccol);
+#endif
if (rc != 0) {
/*
* Fail the last character output, remembering
-/* $OpenBSD: wsemul_vt100_subr.c,v 1.28 2023/01/12 12:34:06 nicm Exp $ */
+/* $OpenBSD: wsemul_vt100_subr.c,v 1.29 2023/01/12 20:39:37 nicm Exp $ */
/* $NetBSD: wsemul_vt100_subr.c,v 1.7 2000/04/28 21:56:16 mycroft Exp $ */
/*
(edp->emulcookie, edp->scrreg_startrow + help, n, edp->bkgdattr));
if (rc != 0)
return rc;
+#ifdef HAVE_DOUBLE_WIDTH_HEIGHT
if (edp->dblwid) {
if (help > 0)
memmove(&edp->dblwid[edp->scrreg_startrow],
memset(&edp->dblwid[edp->scrreg_startrow + help], 0, n);
}
CHECK_DW;
+#endif
return 0;
}
(edp->emulcookie, edp->scrreg_startrow, n, edp->bkgdattr));
if (rc != 0)
return rc;
+#ifdef HAVE_DOUBLE_WIDTH_HEIGHT
if (edp->dblwid) {
if (help > 0)
memmove(&edp->dblwid[edp->scrreg_startrow + n],
memset(&edp->dblwid[edp->scrreg_startrow], 0, n);
}
CHECK_DW;
+#endif
return 0;
}
(edp->emulcookie, edp->crow + 1, n, edp->bkgdattr));
if (rc != 0)
break;
+#ifdef HAVE_DOUBLE_WIDTH_HEIGHT
if (edp->dblwid)
memset(&edp->dblwid[edp->crow + 1], 0, n);
+#endif
}
break;
case 1: /* beginning to cursor */
ERASECOLS(0, edp->ccol + 1, edp->bkgdattr));
if (rc != 0)
break;
+#ifdef HAVE_DOUBLE_WIDTH_HEIGHT
if (edp->dblwid) {
if (edp->crow > 0)
memset(&edp->dblwid[0], 0, edp->crow);
}
+#endif
break;
case 2: /* complete display */
WSEMULOP(rc, edp, &edp->abortstate, eraserows,
(edp->emulcookie, 0, edp->nrows, edp->bkgdattr));
if (rc != 0)
break;
+#ifdef HAVE_DOUBLE_WIDTH_HEIGHT
if (edp->dblwid)
memset(&edp->dblwid[0], 0, edp->nrows);
+#endif
break;
default:
#ifdef VT100_PRINTUNKNOWN
-/* $OpenBSD: wsemul_vt100var.h,v 1.11 2020/05/25 09:55:49 jsg Exp $ */
+/* $OpenBSD: wsemul_vt100var.h,v 1.12 2023/01/12 20:39:37 nicm Exp $ */
/* $NetBSD: wsemul_vt100var.h,v 1.5 2000/04/28 21:56:17 mycroft Exp $ */
/*
u_int scrreg_startrow;
u_int scrreg_nrows;
char *tabs;
+#ifdef HAVE_DOUBLE_WIDTH_HEIGHT
char *dblwid;
int dw;
+#endif
int chartab0, chartab1;
u_int *chartab_G[4];
#define ROWS_ABOVE ((int)edp->crow - (int)edp->scrreg_startrow)
#define ROWS_BELOW ((int)(edp->scrreg_startrow + edp->scrreg_nrows) \
- (int)edp->crow - 1)
+#ifdef HAVE_DOUBLE_WIDTH_HEIGHT
#define CHECK_DW do { \
if (edp->dblwid && edp->dblwid[edp->crow]) { \
edp->dw = 1; \
edp->dw = 0; \
} while (0)
#define NCOLS (edp->ncols >> edp->dw)
-#define COLS_LEFT (NCOLS - edp->ccol - 1)
#define COPYCOLS(f, t, n) (edp->emulcookie, edp->crow, (f) << edp->dw, \
(t) << edp->dw, (n) << edp->dw)
#define ERASECOLS(f, n, a) (edp->emulcookie, edp->crow, (f) << edp->dw, \
- (n) << edp->dw, a)
+ (n) << edp->dw, (a))
+#else
+#define CHECK_DW do { } while (0)
+#define NCOLS (edp->ncols)
+#define COPYCOLS(f, t, n) (edp->emulcookie, edp->crow, (f), (t), (n))
+#define ERASECOLS(f, n, a) (edp->emulcookie, edp->crow, (f), (n), (a))
+#endif
+#define COLS_LEFT (NCOLS - edp->ccol - 1)
/*
* response to primary DA request