diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2023-01-12 20:39:38 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2023-01-12 20:39:38 +0000 |
commit | cd1f552d54e116fcc602813c8fee0a4ec88be063 (patch) | |
tree | c2aad79b6e18d7d49cf7379efa373711990ef129 /sys | |
parent | 32d7b2d91d51f168c40a91a15882550b46448016 (diff) |
Disable double width and height escape sequences under SMALL_KERNEL.
ok miod
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/wscons/wscons_features.h | 6 | ||||
-rw-r--r-- | sys/dev/wscons/wsemul_vt100.c | 29 | ||||
-rw-r--r-- | sys/dev/wscons/wsemul_vt100_subr.c | 12 | ||||
-rw-r--r-- | sys/dev/wscons/wsemul_vt100var.h | 15 |
4 files changed, 55 insertions, 7 deletions
diff --git a/sys/dev/wscons/wscons_features.h b/sys/dev/wscons/wscons_features.h index 29ec3a679cd..1a9cd313366 100644 --- a/sys/dev/wscons/wscons_features.h +++ b/sys/dev/wscons/wscons_features.h @@ -1,4 +1,4 @@ -/* $OpenBSD: wscons_features.h,v 1.4 2020/09/13 10:05:46 fcambus Exp $ */ +/* $OpenBSD: wscons_features.h,v 1.5 2023/01/12 20:39:37 nicm Exp $ */ /* public domain */ /* @@ -22,6 +22,9 @@ * defined to disable most of the restartable emulops code (to be used * only if all wsdisplay drivers are compliant, i.e. no udl(4) in the * kernel configuration) + * HAVE_DOUBLE_WIDTH_HEIGHT + * defined to enable escape sequences for double width and height + * characters */ #ifdef _KERNEL @@ -33,6 +36,7 @@ #define HAVE_JUMP_SCROLL #define HAVE_UTF8_SUPPORT #define HAVE_RESTARTABLE_EMULOPS +#define HAVE_DOUBLE_WIDTH_HEIGHT #endif #endif diff --git a/sys/dev/wscons/wsemul_vt100.c b/sys/dev/wscons/wsemul_vt100.c index fe26d2ad2f1..e38cb5435c1 100644 --- a/sys/dev/wscons/wsemul_vt100.c +++ b/sys/dev/wscons/wsemul_vt100.c @@ -1,4 +1,4 @@ -/* $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 $ */ /* @@ -187,8 +187,10 @@ wsemul_vt100_cnattach(const struct wsscreen_descr *type, void *cookie, int ccol, 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; @@ -217,8 +219,10 @@ wsemul_vt100_attach(int console, const struct wsscreen_descr *type, 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); @@ -238,7 +242,9 @@ wsemul_vt100_detach(void *cookie, u_int *crowp, u_int *ccolp) *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); @@ -382,9 +388,15 @@ wsemul_vt100_output_normal(struct wsemul_vt100_emuldata *edp, } } +#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; @@ -954,12 +966,13 @@ int 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)); @@ -974,11 +987,14 @@ wsemul_vt100_output_esc_hash(struct wsemul_vt100_emuldata *edp, 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)); @@ -997,6 +1013,7 @@ wsemul_vt100_output_esc_hash(struct wsemul_vt100_emuldata *edp, if (edp->ccol > (edp->ncols >> 1) - 1) edp->ccol = (edp->ncols >> 1) - 1; } +#endif break; case '8': { /* DECALN */ int i, j; @@ -1113,7 +1130,11 @@ wsemul_vt100_output(void *cookie, const u_char *data, u_int count, int kernel) 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; } @@ -1213,7 +1234,11 @@ wsemul_vt100_output(void *cookie, const u_char *data, u_int count, int kernel) 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 diff --git a/sys/dev/wscons/wsemul_vt100_subr.c b/sys/dev/wscons/wsemul_vt100_subr.c index 44f0aefe22f..e63d90d73a6 100644 --- a/sys/dev/wscons/wsemul_vt100_subr.c +++ b/sys/dev/wscons/wsemul_vt100_subr.c @@ -1,4 +1,4 @@ -/* $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 $ */ /* @@ -68,6 +68,7 @@ wsemul_vt100_scrollup(struct wsemul_vt100_emuldata *edp, int n) (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], @@ -75,6 +76,7 @@ wsemul_vt100_scrollup(struct wsemul_vt100_emuldata *edp, int n) memset(&edp->dblwid[edp->scrreg_startrow + help], 0, n); } CHECK_DW; +#endif return 0; } @@ -103,6 +105,7 @@ wsemul_vt100_scrolldown(struct wsemul_vt100_emuldata *edp, int n) (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], @@ -110,6 +113,7 @@ wsemul_vt100_scrolldown(struct wsemul_vt100_emuldata *edp, int n) memset(&edp->dblwid[edp->scrreg_startrow], 0, n); } CHECK_DW; +#endif return 0; } @@ -135,8 +139,10 @@ wsemul_vt100_ed(struct wsemul_vt100_emuldata *edp, int arg) (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 */ @@ -150,18 +156,22 @@ wsemul_vt100_ed(struct wsemul_vt100_emuldata *edp, int arg) 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 diff --git a/sys/dev/wscons/wsemul_vt100var.h b/sys/dev/wscons/wsemul_vt100var.h index 07144279524..6d52490216c 100644 --- a/sys/dev/wscons/wsemul_vt100var.h +++ b/sys/dev/wscons/wsemul_vt100var.h @@ -1,4 +1,4 @@ -/* $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 $ */ /* @@ -60,8 +60,10 @@ struct wsemul_vt100_emuldata { 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]; @@ -107,6 +109,7 @@ struct wsemul_vt100_emuldata { #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; \ @@ -116,11 +119,17 @@ struct wsemul_vt100_emuldata { 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 |