Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/wscons wsemul_vt100_subr: complete the refactoring f...
details: https://anonhg.NetBSD.org/src/rev/0f4830eea4fd
branches: trunk
changeset: 378206:0f4830eea4fd
user: uwe <uwe%NetBSD.org@localhost>
date: Wed Jul 26 10:46:01 2023 +0000
description:
wsemul_vt100_subr: complete the refactoring from 2010
In 1.20 refactoring, functions in this file were changed to accept a
pointer to the new base class instead of the full emuldata:
-wsemul_vt100_foo(struct wsemul_vt100_emuldata *edp, ...)
+wsemul_vt100_foo(struct vt100base_data *edp, ...)
but the argument name was not changed. While this saved on the diff
churn back then, it created a rather unfortunate situation where the
same emulation state variables are referred to differently in this
file and other vt100 emulation files. Complete that old change by
renaming the base class arguments to match the variable name used for
it in other files.
Same object code is generated.
diffstat:
sys/dev/wscons/wsemul_vt100_subr.c | 478 ++++++++++++++++++------------------
1 files changed, 239 insertions(+), 239 deletions(-)
diffs (truncated from 993 to 300 lines):
diff -r f54a30e6bb45 -r 0f4830eea4fd sys/dev/wscons/wsemul_vt100_subr.c
--- a/sys/dev/wscons/wsemul_vt100_subr.c Wed Jul 26 09:17:20 2023 +0000
+++ b/sys/dev/wscons/wsemul_vt100_subr.c Wed Jul 26 10:46:01 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wsemul_vt100_subr.c,v 1.30 2023/02/26 14:00:42 uwe Exp $ */
+/* $NetBSD: wsemul_vt100_subr.c,v 1.31 2023/07/26 10:46:01 uwe Exp $ */
/*
* Copyright (c) 1998
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wsemul_vt100_subr.c,v 1.30 2023/02/26 14:00:42 uwe Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsemul_vt100_subr.c,v 1.31 2023/07/26 10:46:01 uwe Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -54,98 +54,98 @@ static int vt100_decmode(struct vt100bas
* scroll up within scrolling region
*/
void
-wsemul_vt100_scrollup(struct vt100base_data *edp, int n)
+wsemul_vt100_scrollup(struct vt100base_data *vd, int n)
{
int help;
- if (n > edp->scrreg_nrows)
- n = edp->scrreg_nrows;
+ if (n > vd->scrreg_nrows)
+ n = vd->scrreg_nrows;
- help = edp->scrreg_nrows - n;
+ help = vd->scrreg_nrows - n;
if (help > 0) {
- (*edp->emulops->copyrows)(edp->emulcookie,
- edp->scrreg_startrow + n,
- edp->scrreg_startrow,
+ (*vd->emulops->copyrows)(vd->emulcookie,
+ vd->scrreg_startrow + n,
+ vd->scrreg_startrow,
help);
- if (edp->dblwid)
- memmove(&edp->dblwid[edp->scrreg_startrow],
- &edp->dblwid[edp->scrreg_startrow + n],
+ if (vd->dblwid)
+ memmove(&vd->dblwid[vd->scrreg_startrow],
+ &vd->dblwid[vd->scrreg_startrow + n],
help);
}
- (*edp->emulops->eraserows)(edp->emulcookie,
- edp->scrreg_startrow + help, n,
- edp->bkgdattr);
- if (edp->dblwid)
- memset(&edp->dblwid[edp->scrreg_startrow + help], 0, n);
- CHECK_DW(edp);
+ (*vd->emulops->eraserows)(vd->emulcookie,
+ vd->scrreg_startrow + help, n,
+ vd->bkgdattr);
+ if (vd->dblwid)
+ memset(&vd->dblwid[vd->scrreg_startrow + help], 0, n);
+ CHECK_DW(vd);
}
/*
* scroll down within scrolling region
*/
void
-wsemul_vt100_scrolldown(struct vt100base_data *edp, int n)
+wsemul_vt100_scrolldown(struct vt100base_data *vd, int n)
{
int help;
- if (n > edp->scrreg_nrows)
- n = edp->scrreg_nrows;
+ if (n > vd->scrreg_nrows)
+ n = vd->scrreg_nrows;
- help = edp->scrreg_nrows - n;
+ help = vd->scrreg_nrows - n;
if (help > 0) {
- (*edp->emulops->copyrows)(edp->emulcookie,
- edp->scrreg_startrow,
- edp->scrreg_startrow + n,
+ (*vd->emulops->copyrows)(vd->emulcookie,
+ vd->scrreg_startrow,
+ vd->scrreg_startrow + n,
help);
- if (edp->dblwid)
- memmove(&edp->dblwid[edp->scrreg_startrow + n],
- &edp->dblwid[edp->scrreg_startrow],
+ if (vd->dblwid)
+ memmove(&vd->dblwid[vd->scrreg_startrow + n],
+ &vd->dblwid[vd->scrreg_startrow],
help);
}
- (*edp->emulops->eraserows)(edp->emulcookie,
- edp->scrreg_startrow, n,
- edp->bkgdattr);
- if (edp->dblwid)
- memset(&edp->dblwid[edp->scrreg_startrow], 0, n);
- CHECK_DW(edp);
+ (*vd->emulops->eraserows)(vd->emulcookie,
+ vd->scrreg_startrow, n,
+ vd->bkgdattr);
+ if (vd->dblwid)
+ memset(&vd->dblwid[vd->scrreg_startrow], 0, n);
+ CHECK_DW(vd);
}
/*
* erase in display
*/
void
-wsemul_vt100_ed(struct vt100base_data *edp, int arg)
+wsemul_vt100_ed(struct vt100base_data *vd, int arg)
{
int n;
switch (arg) {
case 0: /* cursor to end */
- ERASECOLS(edp, edp->ccol, COLS_LEFT(edp) + 1, edp->bkgdattr);
- n = edp->nrows - edp->crow - 1;
+ ERASECOLS(vd, vd->ccol, COLS_LEFT(vd) + 1, vd->bkgdattr);
+ n = vd->nrows - vd->crow - 1;
if (n > 0) {
- (*edp->emulops->eraserows)(edp->emulcookie,
- edp->crow + 1, n,
- edp->bkgdattr);
- if (edp->dblwid)
- memset(&edp->dblwid[edp->crow + 1], 0, n);
+ (*vd->emulops->eraserows)(vd->emulcookie,
+ vd->crow + 1, n,
+ vd->bkgdattr);
+ if (vd->dblwid)
+ memset(&vd->dblwid[vd->crow + 1], 0, n);
}
break;
case 1: /* beginning to cursor */
- if (edp->crow > 0) {
- (*edp->emulops->eraserows)(edp->emulcookie,
- 0, edp->crow,
- edp->bkgdattr);
- if (edp->dblwid)
- memset(&edp->dblwid[0], 0, edp->crow);
+ if (vd->crow > 0) {
+ (*vd->emulops->eraserows)(vd->emulcookie,
+ 0, vd->crow,
+ vd->bkgdattr);
+ if (vd->dblwid)
+ memset(&vd->dblwid[0], 0, vd->crow);
}
- ERASECOLS(edp, 0, edp->ccol + 1, edp->bkgdattr);
+ ERASECOLS(vd, 0, vd->ccol + 1, vd->bkgdattr);
break;
case 2: /* complete display */
- (*edp->emulops->eraserows)(edp->emulcookie,
- 0, edp->nrows,
- edp->bkgdattr);
- if (edp->dblwid)
- memset(&edp->dblwid[0], 0, edp->nrows);
+ (*vd->emulops->eraserows)(vd->emulcookie,
+ 0, vd->nrows,
+ vd->bkgdattr);
+ if (vd->dblwid)
+ memset(&vd->dblwid[0], 0, vd->nrows);
break;
default:
#ifdef VT100_PRINTUNKNOWN
@@ -153,26 +153,26 @@ wsemul_vt100_ed(struct vt100base_data *e
#endif
break;
}
- CHECK_DW(edp);
+ CHECK_DW(vd);
}
/*
* erase in line
*/
void
-wsemul_vt100_el(struct vt100base_data *edp, int arg)
+wsemul_vt100_el(struct vt100base_data *vd, int arg)
{
switch (arg) {
case 0: /* cursor to end */
- ERASECOLS(edp, edp->ccol, COLS_LEFT(edp) + 1, edp->bkgdattr);
+ ERASECOLS(vd, vd->ccol, COLS_LEFT(vd) + 1, vd->bkgdattr);
break;
case 1: /* beginning to cursor */
- ERASECOLS(edp, 0, edp->ccol + 1, edp->bkgdattr);
+ ERASECOLS(vd, 0, vd->ccol + 1, vd->bkgdattr);
break;
case 2: /* complete line */
- (*edp->emulops->erasecols)(edp->emulcookie, edp->crow,
- 0, edp->ncols,
- edp->bkgdattr);
+ (*vd->emulops->erasecols)(vd->emulcookie, vd->crow,
+ 0, vd->ncols,
+ vd->bkgdattr);
break;
default:
#ifdef VT100_PRINTUNKNOWN
@@ -186,76 +186,76 @@ wsemul_vt100_el(struct vt100base_data *e
* handle commands after CSI (ESC[)
*/
void
-wsemul_vt100_handle_csi(struct vt100base_data *edp, u_char c)
+wsemul_vt100_handle_csi(struct vt100base_data *vd, u_char c)
{
int n, m, help, flags, fgcol, bgcol;
long attr, bkgdattr;
#define A3(a, b, c) (((a) << 16) | ((b) << 8) | (c))
- switch (A3(edp->modif1, edp->modif2, c)) {
+ switch (A3(vd->modif1, vd->modif2, c)) {
case A3('>', '\0', 'c'): /* DA secondary */
- wsdisplay_emulinput(edp->cbcookie, WSEMUL_VT_ID2,
+ wsdisplay_emulinput(vd->cbcookie, WSEMUL_VT_ID2,
sizeof(WSEMUL_VT_ID2) - 1);
break;
case A3('\0', '\0', 'J'): /* ED selective erase in display */
case A3('?', '\0', 'J'): /* DECSED selective erase in display */
- wsemul_vt100_ed(edp, ARG(edp, 0));
+ wsemul_vt100_ed(vd, ARG(vd, 0));
break;
case A3('\0', '\0', 'K'): /* EL selective erase in line */
case A3('?', '\0', 'K'): /* DECSEL selective erase in line */
- wsemul_vt100_el(edp, ARG(edp, 0));
+ wsemul_vt100_el(vd, ARG(vd, 0));
break;
case A3('\0', '\0', 'h'): /* SM */
- for (n = 0; n < edp->nargs; n++)
- vt100_ansimode(edp, ARG(edp, n), VTMODE_SET);
+ for (n = 0; n < vd->nargs; n++)
+ vt100_ansimode(vd, ARG(vd, n), VTMODE_SET);
break;
case A3('?', '\0', 'h'): /* DECSM */
- for (n = 0; n < edp->nargs; n++)
- vt100_decmode(edp, ARG(edp, n), VTMODE_SET);
+ for (n = 0; n < vd->nargs; n++)
+ vt100_decmode(vd, ARG(vd, n), VTMODE_SET);
break;
case A3('\0', '\0', 'l'): /* RM */
- for (n = 0; n < edp->nargs; n++)
- vt100_ansimode(edp, ARG(edp, n), VTMODE_RESET);
+ for (n = 0; n < vd->nargs; n++)
+ vt100_ansimode(vd, ARG(vd, n), VTMODE_RESET);
break;
case A3('?', '\0', 'l'): /* DECRM */
- for (n = 0; n < edp->nargs; n++)
- vt100_decmode(edp, ARG(edp, n), VTMODE_RESET);
+ for (n = 0; n < vd->nargs; n++)
+ vt100_decmode(vd, ARG(vd, n), VTMODE_RESET);
break;
case A3('\0', '$', 'p'): /* DECRQM request mode ANSI */
- vt100_ansimode(edp, ARG(edp, 0), VTMODE_REPORT);
+ vt100_ansimode(vd, ARG(vd, 0), VTMODE_REPORT);
break;
case A3('?', '$', 'p'): /* DECRQM request mode DEC */
- vt100_decmode(edp, ARG(edp, 0), VTMODE_REPORT);
+ vt100_decmode(vd, ARG(vd, 0), VTMODE_REPORT);
break;
case A3('\0', '\0', 'i'): /* MC printer controller mode */
case A3('?', '\0', 'i'): /* MC printer controller mode */
- switch (ARG(edp, 0)) {
+ switch (ARG(vd, 0)) {
case 0: /* print screen */
case 1: /* print cursor line */
case 4: /* off */
case 5: /* on */
#ifdef VT100_PRINTNOTIMPL
- printf("CSI%di ignored\n", ARG(edp, 0));
+ printf("CSI%di ignored\n", ARG(vd, 0));
#endif
break;
default:
#ifdef VT100_PRINTUNKNOWN
- printf("CSI%di unknown\n", ARG(edp, 0));
+ printf("CSI%di unknown\n", ARG(vd, 0));
#endif
break;
}
break;
#define A2(a, b) (((a) << 8) | (b))
-#if 0 /* XXX */
+#if 0 /* XXX: edp not available here */
case A2('!', 'p'): /* DECSTR soft reset VT300 only */
wsemul_vt100_reset(edp);
break;
#endif
case A2('"', 'p'): /* DECSCL */
- switch (ARG(edp, 0)) {
+ switch (ARG(vd, 0)) {
case 61: /* VT100 mode (no further arguments!) */
break;
case 62:
Home |
Main Index |
Thread Index |
Old Index