diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2007-11-27 16:37:28 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2007-11-27 16:37:28 +0000 |
commit | 661bb1dc316274e863790dc316fd698c664f4b92 (patch) | |
tree | 5be693a1194324e70cb947f9188f2be14a4b7e25 /sys | |
parent | 318f6d242a348ed7f21f9cf1556e56f21b46eba3 (diff) |
Remove whitespace at EOL, KNF, ansify. Move jump scroll code to a separate
routine. No functional change (har, har)
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/wscons/wsemul_dumb.c | 4 | ||||
-rw-r--r-- | sys/dev/wscons/wsemul_sun.c | 201 | ||||
-rw-r--r-- | sys/dev/wscons/wsemul_vt100.c | 338 | ||||
-rw-r--r-- | sys/dev/wscons/wsemul_vt100_chars.c | 11 | ||||
-rw-r--r-- | sys/dev/wscons/wsemul_vt100_keys.c | 7 | ||||
-rw-r--r-- | sys/dev/wscons/wsemul_vt100_subr.c | 167 | ||||
-rw-r--r-- | sys/dev/wscons/wsemul_vt100var.h | 22 | ||||
-rw-r--r-- | sys/dev/wscons/wsemulvar.h | 6 |
8 files changed, 319 insertions, 437 deletions
diff --git a/sys/dev/wscons/wsemul_dumb.c b/sys/dev/wscons/wsemul_dumb.c index 7ed932d355b..5a53b095323 100644 --- a/sys/dev/wscons/wsemul_dumb.c +++ b/sys/dev/wscons/wsemul_dumb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wsemul_dumb.c,v 1.6 2007/11/26 16:56:42 miod Exp $ */ +/* $OpenBSD: wsemul_dumb.c,v 1.7 2007/11/27 16:37:27 miod Exp $ */ /* $NetBSD: wsemul_dumb.c,v 1.7 2000/01/05 11:19:36 drochner Exp $ */ /* @@ -220,7 +220,7 @@ wsemul_dumb_output(cookie, data, count, kernel) edp->nrows - n, n, edp->defattr); edp->crow -= n - 1; break; - } + } } /* XXX */ (*edp->emulops->cursor)(edp->emulcookie, 1, edp->crow, edp->ccol); diff --git a/sys/dev/wscons/wsemul_sun.c b/sys/dev/wscons/wsemul_sun.c index 814d10eac4b..691921cf71f 100644 --- a/sys/dev/wscons/wsemul_sun.c +++ b/sys/dev/wscons/wsemul_sun.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wsemul_sun.c,v 1.22 2007/11/26 16:56:42 miod Exp $ */ +/* $OpenBSD: wsemul_sun.c,v 1.23 2007/11/27 16:37:27 miod Exp $ */ /* $NetBSD: wsemul_sun.c,v 1.11 2000/01/05 11:19:36 drochner Exp $ */ /* @@ -101,17 +101,19 @@ struct wsemul_sun_emuldata { #endif }; -void wsemul_sun_init(struct wsemul_sun_emuldata *, - const struct wsscreen_descr *, void *, int, int, long); -void wsemul_sun_reset(struct wsemul_sun_emuldata *); -void wsemul_sun_output_lowchars(struct wsemul_sun_emuldata *, u_char, int); -void wsemul_sun_output_normal(struct wsemul_sun_emuldata *, u_char, int); -u_int wsemul_sun_output_haveesc(struct wsemul_sun_emuldata *, u_char); -u_int wsemul_sun_output_control(struct wsemul_sun_emuldata *, u_char); -void wsemul_sun_control(struct wsemul_sun_emuldata *, u_char); -int wsemul_sun_selectattribute(struct wsemul_sun_emuldata *, int, int, int, - long *, long *); -void wsemul_sun_scrollup(struct wsemul_sun_emuldata *, u_int); +void wsemul_sun_init(struct wsemul_sun_emuldata *, + const struct wsscreen_descr *, void *, int, int, long); +void wsemul_sun_jump_scroll(struct wsemul_sun_emuldata *, const u_char *, + u_int, int); +void wsemul_sun_reset(struct wsemul_sun_emuldata *); +void wsemul_sun_output_lowchars(struct wsemul_sun_emuldata *, u_char, int); +void wsemul_sun_output_normal(struct wsemul_sun_emuldata *, u_char, int); +u_int wsemul_sun_output_haveesc(struct wsemul_sun_emuldata *, u_char); +u_int wsemul_sun_output_control(struct wsemul_sun_emuldata *, u_char); +void wsemul_sun_control(struct wsemul_sun_emuldata *, u_char); +int wsemul_sun_selectattribute(struct wsemul_sun_emuldata *, int, int, int, + long *, long *); +void wsemul_sun_scrollup(struct wsemul_sun_emuldata *, u_int); struct wsemul_sun_emuldata wsemul_sun_console_emuldata; @@ -123,12 +125,9 @@ struct wsemul_sun_emuldata wsemul_sun_console_emuldata; #define ROWS_LEFT (edp->nrows - 1 - edp->crow) void -wsemul_sun_init(edp, type, cookie, ccol, crow, defattr) - struct wsemul_sun_emuldata *edp; - const struct wsscreen_descr *type; - void *cookie; - int ccol, crow; - long defattr; +wsemul_sun_init(struct wsemul_sun_emuldata *edp, + const struct wsscreen_descr *type, void *cookie, int ccol, int crow, + long defattr) { edp->emulops = type->textops; edp->emulcookie = cookie; @@ -141,8 +140,7 @@ wsemul_sun_init(edp, type, cookie, ccol, crow, defattr) } void -wsemul_sun_reset(edp) - struct wsemul_sun_emuldata *edp; +wsemul_sun_reset(struct wsemul_sun_emuldata *edp) { edp->state = SUN_EMUL_STATE_NORMAL; edp->bkgdattr = edp->curattr = edp->defattr; @@ -153,11 +151,8 @@ wsemul_sun_reset(edp) } void * -wsemul_sun_cnattach(type, cookie, ccol, crow, defattr) - const struct wsscreen_descr *type; - void *cookie; - int ccol, crow; - long defattr; +wsemul_sun_cnattach(const struct wsscreen_descr *type, void *cookie, int ccol, + int crow, long defattr) { struct wsemul_sun_emuldata *edp; int res; @@ -200,13 +195,8 @@ wsemul_sun_cnattach(type, cookie, ccol, crow, defattr) } void * -wsemul_sun_attach(console, type, cookie, ccol, crow, cbcookie, defattr) - int console; - const struct wsscreen_descr *type; - void *cookie; - int ccol, crow; - void *cbcookie; - long defattr; +wsemul_sun_attach(int console, const struct wsscreen_descr *type, void *cookie, + int ccol, int crow, void *cbcookie, long defattr) { struct wsemul_sun_emuldata *edp; @@ -233,10 +223,8 @@ wsemul_sun_attach(console, type, cookie, ccol, crow, cbcookie, defattr) } void -wsemul_sun_output_lowchars(edp, c, kernel) - struct wsemul_sun_emuldata *edp; - u_char c; - int kernel; +wsemul_sun_output_lowchars(struct wsemul_sun_emuldata *edp, u_char c, + int kernel) { u_int n; @@ -301,10 +289,7 @@ wsemul_sun_output_lowchars(edp, c, kernel) } void -wsemul_sun_output_normal(edp, c, kernel) - struct wsemul_sun_emuldata *edp; - u_char c; - int kernel; +wsemul_sun_output_normal(struct wsemul_sun_emuldata *edp, u_char c, int kernel) { (*edp->emulops->putchar)(edp->emulcookie, edp->crow, edp->ccol, @@ -321,9 +306,7 @@ wsemul_sun_output_normal(edp, c, kernel) } u_int -wsemul_sun_output_haveesc(edp, c) - struct wsemul_sun_emuldata *edp; - u_char c; +wsemul_sun_output_haveesc(struct wsemul_sun_emuldata *edp, u_char c) { u_int newstate; @@ -346,9 +329,7 @@ wsemul_sun_output_haveesc(edp, c) } void -wsemul_sun_control(edp, c) - struct wsemul_sun_emuldata *edp; - u_char c; +wsemul_sun_control(struct wsemul_sun_emuldata *edp, u_char c) { u_int n, src, dst; int flags, fgcol, bgcol; @@ -523,9 +504,7 @@ setattr: } u_int -wsemul_sun_output_control(edp, c) - struct wsemul_sun_emuldata *edp; - u_char c; +wsemul_sun_output_control(struct wsemul_sun_emuldata *edp, u_char c) { u_int newstate = SUN_EMUL_STATE_CONTROL; @@ -561,19 +540,10 @@ wsemul_sun_output_control(edp, c) } void -wsemul_sun_output(cookie, data, count, kernel) - void *cookie; - const u_char *data; - u_int count; - int kernel; +wsemul_sun_output(void *cookie, const u_char *data, u_int count, int kernel) { struct wsemul_sun_emuldata *edp = cookie; u_int newstate; -#ifdef JUMP_SCROLL - const u_char *eot; - u_char curchar; - u_int cnt, pos, lines; -#endif #ifdef DIAGNOSTIC if (kernel && !edp->console) @@ -591,46 +561,8 @@ wsemul_sun_output(cookie, data, count, kernel) * appears. */ if ((edp->state == SUN_EMUL_STATE_NORMAL || kernel) && - ROWS_LEFT == 0 && edp->scrolldist != 0) { - lines = 0; - pos = edp->ccol; - for (eot = data, cnt = count; cnt != 0; eot++, cnt--) { - curchar = *eot; - if (curchar == ASCII_FF || - curchar == ASCII_VT || curchar == ASCII_ESC) - break; - - switch (curchar) { - case ASCII_BS: - if (pos > 0) - pos--; - break; - case ASCII_CR: - pos = 0; - break; - case ASCII_HT: - pos = (pos + 7) & ~7; - if (pos >= edp->ncols) - pos = edp->ncols - 1; - break; - default: - if (++pos >= edp->ncols) { - pos = 0; - curchar = ASCII_LF; - } - break; - } - if (curchar == ASCII_LF) { - if (++lines >= edp->nrows - 1) - break; - } - } - - if (lines > 1) { - wsemul_sun_scrollup(edp, lines); - edp->crow--; - } - } + ROWS_LEFT == 0 && edp->scrolldist != 0) + wsemul_sun_jump_scroll(edp, data, count, kernel); #endif if (*data < ' ') { @@ -669,16 +601,62 @@ wsemul_sun_output(cookie, data, count, kernel) (*edp->emulops->cursor)(edp->emulcookie, 1, edp->crow, edp->ccol); } +#ifdef JUMP_SCROLL +void +wsemul_sun_jump_scroll(struct wsemul_sun_emuldata *edp, const u_char *data, + u_int count, int kernel) +{ + u_char curchar; + u_int pos, lines; + + lines = 0; + pos = edp->ccol; + for (; count != 0; data++, count--) { + curchar = *data; + if (curchar == ASCII_FF || + curchar == ASCII_VT || curchar == ASCII_ESC) + break; + + switch (curchar) { + case ASCII_BS: + if (pos > 0) + pos--; + break; + case ASCII_CR: + pos = 0; + break; + case ASCII_HT: + pos = (pos + 7) & ~7; + if (pos >= edp->ncols) + pos = edp->ncols - 1; + break; + default: + if (++pos >= edp->ncols) { + pos = 0; + curchar = ASCII_LF; + } + break; + } + if (curchar == ASCII_LF) { + if (++lines >= edp->nrows - 1) + break; + } + } + + if (lines > 1) { + wsemul_sun_scrollup(edp, lines); + edp->crow--; + } +} +#endif /* * Get an attribute from the graphics driver. * Try to find replacements if the desired appearance is not supported. */ int -wsemul_sun_selectattribute(edp, flags, fgcol, bgcol, attr, bkgdattr) - struct wsemul_sun_emuldata *edp; - int flags, fgcol, bgcol; - long *attr, *bkgdattr; +wsemul_sun_selectattribute(struct wsemul_sun_emuldata *edp, int flags, + int fgcol, int bgcol, long *attr, long *bkgdattr) { int error; @@ -769,10 +747,7 @@ static const char *sun_lkeys[] = { }; int -wsemul_sun_translate(cookie, in, out) - void *cookie; - keysym_t in; - const char **out; +wsemul_sun_translate(void *cookie, keysym_t in, const char **out) { static char c; @@ -845,9 +820,7 @@ wsemul_sun_translate(cookie, in, out) } void -wsemul_sun_detach(cookie, crowp, ccolp) - void *cookie; - u_int *crowp, *ccolp; +wsemul_sun_detach(void *cookie, u_int *crowp, u_int *ccolp) { struct wsemul_sun_emuldata *edp = cookie; @@ -858,9 +831,7 @@ wsemul_sun_detach(cookie, crowp, ccolp) } void -wsemul_sun_resetop(cookie, op) - void *cookie; - enum wsemul_resetops op; +wsemul_sun_resetop(void *cookie, enum wsemul_resetops op) { struct wsemul_sun_emuldata *edp = cookie; @@ -884,9 +855,7 @@ wsemul_sun_resetop(cookie, op) } void -wsemul_sun_scrollup(edp, lines) - struct wsemul_sun_emuldata *edp; - u_int lines; +wsemul_sun_scrollup(struct wsemul_sun_emuldata *edp, u_int lines) { /* * if we're in wrap-around mode, go to the first diff --git a/sys/dev/wscons/wsemul_vt100.c b/sys/dev/wscons/wsemul_vt100.c index 4ee96d99a59..08e563290b1 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.21 2007/11/25 19:11:43 miod Exp $ */ +/* $OpenBSD: wsemul_vt100.c,v 1.22 2007/11/27 16:37:27 miod Exp $ */ /* $NetBSD: wsemul_vt100.c,v 1.13 2000/04/28 21:56:16 mycroft Exp $ */ /* @@ -64,29 +64,27 @@ const struct wsemul_ops wsemul_vt100_ops = { struct wsemul_vt100_emuldata wsemul_vt100_console_emuldata; -void wsemul_vt100_init(struct wsemul_vt100_emuldata *, - const struct wsscreen_descr *, void *, int, int, - long); - -void wsemul_vt100_output_normal(struct wsemul_vt100_emuldata *, u_char, - int); -void wsemul_vt100_output_c0c1(struct wsemul_vt100_emuldata *, u_char, - int); -void wsemul_vt100_nextline(struct wsemul_vt100_emuldata *); +void wsemul_vt100_init(struct wsemul_vt100_emuldata *, + const struct wsscreen_descr *, void *, int, int, long); +void wsemul_vt100_jump_scroll(struct wsemul_vt100_emuldata *, + const u_char *, u_int, int); +void wsemul_vt100_output_normal(struct wsemul_vt100_emuldata *, u_char, int); +void wsemul_vt100_output_c0c1(struct wsemul_vt100_emuldata *, u_char, int); +void wsemul_vt100_nextline(struct wsemul_vt100_emuldata *); typedef u_int vt100_handler(struct wsemul_vt100_emuldata *, u_char); vt100_handler -wsemul_vt100_output_esc, -wsemul_vt100_output_csi, -wsemul_vt100_output_scs94, -wsemul_vt100_output_scs94_percent, -wsemul_vt100_output_scs96, -wsemul_vt100_output_scs96_percent, -wsemul_vt100_output_esc_hash, -wsemul_vt100_output_esc_spc, -wsemul_vt100_output_string, -wsemul_vt100_output_string_esc, -wsemul_vt100_output_dcs, -wsemul_vt100_output_dcs_dollar; + wsemul_vt100_output_esc, + wsemul_vt100_output_csi, + wsemul_vt100_output_scs94, + wsemul_vt100_output_scs94_percent, + wsemul_vt100_output_scs96, + wsemul_vt100_output_scs96_percent, + wsemul_vt100_output_esc_hash, + wsemul_vt100_output_esc_spc, + wsemul_vt100_output_string, + wsemul_vt100_output_string_esc, + wsemul_vt100_output_dcs, + wsemul_vt100_output_dcs_dollar; #define VT100_EMUL_STATE_NORMAL 0 /* normal processing */ #define VT100_EMUL_STATE_ESC 1 /* got ESC */ @@ -118,12 +116,9 @@ vt100_handler *vt100_output[] = { }; void -wsemul_vt100_init(edp, type, cookie, ccol, crow, defattr) - struct wsemul_vt100_emuldata *edp; - const struct wsscreen_descr *type; - void *cookie; - int ccol, crow; - long defattr; +wsemul_vt100_init(struct wsemul_vt100_emuldata *edp, + const struct wsscreen_descr *type, void *cookie, int ccol, int crow, + long defattr) { edp->emulops = type->textops; edp->emulcookie = cookie; @@ -136,11 +131,8 @@ wsemul_vt100_init(edp, type, cookie, ccol, crow, defattr) } void * -wsemul_vt100_cnattach(type, cookie, ccol, crow, defattr) - const struct wsscreen_descr *type; - void *cookie; - int ccol, crow; - long defattr; +wsemul_vt100_cnattach(const struct wsscreen_descr *type, void *cookie, int ccol, + int crow, long defattr) { struct wsemul_vt100_emuldata *edp; int res; @@ -166,13 +158,11 @@ wsemul_vt100_cnattach(type, cookie, ccol, crow, defattr) #endif if (type->capabilities & WSSCREEN_WSCOLORS) res = (*edp->emulops->alloc_attr)(cookie, - WS_KERNEL_FG, WS_KERNEL_BG, - WS_KERNEL_COLATTR | WSATTR_WSCOLORS, - &edp->kernattr); + WS_KERNEL_FG, WS_KERNEL_BG, + WS_KERNEL_COLATTR | WSATTR_WSCOLORS, &edp->kernattr); else res = (*edp->emulops->alloc_attr)(cookie, 0, 0, - WS_KERNEL_MONOATTR, - &edp->kernattr); + WS_KERNEL_MONOATTR, &edp->kernattr); if (res) edp->kernattr = defattr; @@ -187,13 +177,8 @@ wsemul_vt100_cnattach(type, cookie, ccol, crow, defattr) } void * -wsemul_vt100_attach(console, type, cookie, ccol, crow, cbcookie, defattr) - int console; - const struct wsscreen_descr *type; - void *cookie; - int ccol, crow; - void *cbcookie; - long defattr; +wsemul_vt100_attach(int console, const struct wsscreen_descr *type, + void *cookie, int ccol, int crow, void *cbcookie, long defattr) { struct wsemul_vt100_emuldata *edp; @@ -227,9 +212,7 @@ wsemul_vt100_attach(console, type, cookie, ccol, crow, cbcookie, defattr) } void -wsemul_vt100_detach(cookie, crowp, ccolp) - void *cookie; - u_int *crowp, *ccolp; +wsemul_vt100_detach(void *cookie, u_int *crowp, u_int *ccolp) { struct wsemul_vt100_emuldata *edp = cookie; @@ -249,9 +232,7 @@ wsemul_vt100_detach(cookie, crowp, ccolp) } void -wsemul_vt100_resetop(cookie, op) - void *cookie; - enum wsemul_resetops op; +wsemul_vt100_resetop(void *cookie, enum wsemul_resetops op) { struct wsemul_vt100_emuldata *edp = cookie; @@ -266,7 +247,7 @@ wsemul_vt100_resetop(cookie, op) wsemul_vt100_ed(edp, 2); edp->ccol = edp->crow = 0; (*edp->emulops->cursor)(edp->emulcookie, - edp->flags & VTFL_CURSORON, 0, 0); + edp->flags & VTFL_CURSORON, 0, 0); break; case WSEMUL_CLEARCURSOR: (*edp->emulops->cursor)(edp->emulcookie, 0, @@ -278,8 +259,7 @@ wsemul_vt100_resetop(cookie, op) } void -wsemul_vt100_reset(edp) - struct wsemul_vt100_emuldata *edp; +wsemul_vt100_reset(struct wsemul_vt100_emuldata *edp) { int i; @@ -324,17 +304,15 @@ wsemul_vt100_nextline(struct wsemul_vt100_emuldata *edp) edp->crow++; CHECK_DW; } -} +} /* * now all the state machine bits */ void -wsemul_vt100_output_normal(edp, c, kernel) - struct wsemul_vt100_emuldata *edp; - u_char c; - int kernel; +wsemul_vt100_output_normal(struct wsemul_vt100_emuldata *edp, u_char c, + int kernel) { u_int *ct, dc; @@ -361,8 +339,7 @@ wsemul_vt100_output_normal(edp, c, kernel) COPYCOLS(edp->ccol, edp->ccol + 1, COLS_LEFT); (*edp->emulops->putchar)(edp->emulcookie, edp->crow, - edp->ccol << edp->dw, dc, - kernel ? edp->kernattr : edp->curattr); + edp->ccol << edp->dw, dc, kernel ? edp->kernattr : edp->curattr); if (COLS_LEFT) edp->ccol++; @@ -371,10 +348,8 @@ wsemul_vt100_output_normal(edp, c, kernel) } void -wsemul_vt100_output_c0c1(edp, c, kernel) - struct wsemul_vt100_emuldata *edp; - u_char c; - int kernel; +wsemul_vt100_output_c0c1(struct wsemul_vt100_emuldata *edp, u_char c, + int kernel) { u_int n; @@ -457,9 +432,7 @@ wsemul_vt100_output_c0c1(edp, c, kernel) } u_int -wsemul_vt100_output_esc(edp, c) - struct wsemul_vt100_emuldata *edp; - u_char c; +wsemul_vt100_output_esc(struct wsemul_vt100_emuldata *edp, u_char c) { u_int newstate = VT100_EMUL_STATE_NORMAL; int i; @@ -577,7 +550,7 @@ wsemul_vt100_output_esc(edp, c) break; case '<': /* exit VT52 mode - ignored */ break; - default: + default: #ifdef VT100_PRINTUNKNOWN printf("ESC%c unknown\n", c); #endif @@ -588,9 +561,7 @@ wsemul_vt100_output_esc(edp, c) } u_int -wsemul_vt100_output_scs94(edp, c) - struct wsemul_vt100_emuldata *edp; - u_char c; +wsemul_vt100_output_scs94(struct wsemul_vt100_emuldata *edp, u_char c) { u_int newstate = VT100_EMUL_STATE_NORMAL; @@ -614,7 +585,7 @@ wsemul_vt100_output_scs94(edp, c) case '>': /* DEC tech */ edp->chartab_G[edp->designating] = edp->dectechtab; break; - default: + default: #ifdef VT100_PRINTUNKNOWN printf("ESC%c%c unknown\n", edp->designating + '(', c); #endif @@ -624,16 +595,14 @@ wsemul_vt100_output_scs94(edp, c) } u_int -wsemul_vt100_output_scs94_percent(edp, c) - struct wsemul_vt100_emuldata *edp; - u_char c; +wsemul_vt100_output_scs94_percent(struct wsemul_vt100_emuldata *edp, u_char c) { switch (c) { case '5': /* DEC supplemental graphic */ /* XXX there are differences */ edp->chartab_G[edp->designating] = edp->isolatin1tab; break; - default: + default: #ifdef VT100_PRINTUNKNOWN printf("ESC%c%%%c unknown\n", edp->designating + '(', c); #endif @@ -643,15 +612,13 @@ wsemul_vt100_output_scs94_percent(edp, c) } u_int -wsemul_vt100_output_scs96(edp, c) - struct wsemul_vt100_emuldata *edp; - u_char c; +wsemul_vt100_output_scs96(struct wsemul_vt100_emuldata *edp, u_char c) { u_int newstate = VT100_EMUL_STATE_NORMAL; int nrc; switch (c) { - case '%': /* probably portugese */ + case '%': /* probably portuguese */ newstate = VT100_EMUL_STATE_SCS96_PERCENT; break; case 'A': /* ISO-latin-1 supplemental */ @@ -690,7 +657,7 @@ setnrc: if (vt100_setnrc(edp, nrc) == 0) /* what table ??? */ break; /* else FALLTHROUGH */ - default: + default: #ifdef VT100_PRINTUNKNOWN printf("ESC%c%c unknown\n", edp->designating + '-' - 1, c); #endif @@ -700,16 +667,14 @@ setnrc: } u_int -wsemul_vt100_output_scs96_percent(edp, c) - struct wsemul_vt100_emuldata *edp; - u_char c; +wsemul_vt100_output_scs96_percent(struct wsemul_vt100_emuldata *edp, u_char c) { switch (c) { - case '6': /* portugese */ + case '6': /* portuguese */ if (vt100_setnrc(edp, 8) == 0) break; /* else FALLTHROUGH */ - default: + default: #ifdef VT100_PRINTUNKNOWN printf("ESC%c%%%c unknown\n", edp->designating + '-' - 1, c); #endif @@ -719,9 +684,7 @@ wsemul_vt100_output_scs96_percent(edp, c) } u_int -wsemul_vt100_output_esc_spc(edp, c) - struct wsemul_vt100_emuldata *edp; - u_char c; +wsemul_vt100_output_esc_spc(struct wsemul_vt100_emuldata *edp, u_char c) { switch (c) { case 'F': /* 7-bit controls */ @@ -730,7 +693,7 @@ wsemul_vt100_output_esc_spc(edp, c) printf("ESC<SPC>%c ignored\n", c); #endif break; - default: + default: #ifdef VT100_PRINTUNKNOWN printf("ESC<SPC>%c unknown\n", c); #endif @@ -740,9 +703,7 @@ wsemul_vt100_output_esc_spc(edp, c) } u_int -wsemul_vt100_output_string(edp, c) - struct wsemul_vt100_emuldata *edp; - u_char c; +wsemul_vt100_output_string(struct wsemul_vt100_emuldata *edp, u_char c) { if (edp->dcstype && edp->dcspos < DCS_MAXLEN) edp->dcsarg[edp->dcspos++] = c; @@ -750,9 +711,7 @@ wsemul_vt100_output_string(edp, c) } u_int -wsemul_vt100_output_string_esc(edp, c) - struct wsemul_vt100_emuldata *edp; - u_char c; +wsemul_vt100_output_string_esc(struct wsemul_vt100_emuldata *edp, u_char c) { if (c == '\\') { /* ST complete */ wsemul_vt100_handle_dcs(edp); @@ -762,9 +721,7 @@ wsemul_vt100_output_string_esc(edp, c) } u_int -wsemul_vt100_output_dcs(edp, c) - struct wsemul_vt100_emuldata *edp; - u_char c; +wsemul_vt100_output_dcs(struct wsemul_vt100_emuldata *edp, u_char c) { u_int newstate = VT100_EMUL_STATE_DCS; @@ -780,7 +737,7 @@ wsemul_vt100_output_dcs(edp, c) case ';': /* argument terminator */ edp->nargs++; break; - default: + default: edp->nargs++; if (edp->nargs > VT100_EMUL_NARGS) { #ifdef VT100_DEBUG @@ -801,7 +758,7 @@ wsemul_vt100_output_dcs(edp, c) printf("DCS%c ignored\n", c); #endif break; - default: + default: #ifdef VT100_PRINTUNKNOWN printf("DCS%c (%d, %d) unknown\n", c, ARG(0), ARG(1)); #endif @@ -813,9 +770,7 @@ wsemul_vt100_output_dcs(edp, c) } u_int -wsemul_vt100_output_dcs_dollar(edp, c) - struct wsemul_vt100_emuldata *edp; - u_char c; +wsemul_vt100_output_dcs_dollar(struct wsemul_vt100_emuldata *edp, u_char c) { switch (c) { case 'p': /* DECRSTS terminal state restore */ @@ -837,14 +792,14 @@ wsemul_vt100_output_dcs_dollar(edp, c) edp->dcspos = 0; edp->dcstype = DCSTYPE_TABRESTORE; break; - default: + default: #ifdef VT100_PRINTUNKNOWN printf("DCS%d$t unknown\n", ARG(0)); #endif break; } break; - default: + default: #ifdef VT100_PRINTUNKNOWN printf("DCS$%c (%d, %d) unknown\n", c, ARG(0), ARG(1)); #endif @@ -854,9 +809,7 @@ wsemul_vt100_output_dcs_dollar(edp, c) } u_int -wsemul_vt100_output_esc_hash(edp, c) - struct wsemul_vt100_emuldata *edp; - u_char c; +wsemul_vt100_output_esc_hash(struct wsemul_vt100_emuldata *edp, u_char c) { int i; @@ -865,11 +818,9 @@ wsemul_vt100_output_esc_hash(edp, c) if (edp->dblwid != NULL && edp->dw != 0) { for (i = 0; i < edp->ncols / 2; i++) (*edp->emulops->copycols)(edp->emulcookie, - edp->crow, - 2 * i, i, 1); + edp->crow, 2 * i, i, 1); (*edp->emulops->erasecols)(edp->emulcookie, edp->crow, - i, edp->ncols - i, - edp->bkgdattr); + i, edp->ncols - i, edp->bkgdattr); edp->dblwid[edp->crow] = 0; edp->dw = 0; } @@ -880,13 +831,10 @@ wsemul_vt100_output_esc_hash(edp, c) if (edp->dblwid != NULL && edp->dw == 0) { for (i = edp->ncols / 2 - 1; i >= 0; i--) (*edp->emulops->copycols)(edp->emulcookie, - edp->crow, - i, 2 * i, 1); + edp->crow, i, 2 * i, 1); for (i = 0; i < edp->ncols / 2; i++) (*edp->emulops->erasecols)(edp->emulcookie, - edp->crow, - 2 * i + 1, 1, - edp->bkgdattr); + edp->crow, 2 * i + 1, 1, edp->bkgdattr); edp->dblwid[edp->crow] = 1; edp->dw = 1; if (edp->ccol > (edp->ncols >> 1) - 1) @@ -898,12 +846,12 @@ wsemul_vt100_output_esc_hash(edp, c) for (i = 0; i < edp->nrows; i++) for (j = 0; j < edp->ncols; j++) (*edp->emulops->putchar)(edp->emulcookie, i, j, - 'E', edp->curattr); + 'E', edp->curattr); } edp->ccol = 0; edp->crow = 0; break; - default: + default: #ifdef VT100_PRINTUNKNOWN printf("ESC#%c unknown\n", c); #endif @@ -913,9 +861,7 @@ wsemul_vt100_output_esc_hash(edp, c) } u_int -wsemul_vt100_output_csi(edp, c) - struct wsemul_vt100_emuldata *edp; - u_char c; +wsemul_vt100_output_csi(struct wsemul_vt100_emuldata *edp, u_char c) { u_int newstate = VT100_EMUL_STATE_CSI; @@ -941,7 +887,7 @@ wsemul_vt100_output_csi(edp, c) case '&': edp->modif2 = c; break; - default: /* end of escape sequence */ + default: /* end of escape sequence */ edp->nargs++; if (edp->nargs > VT100_EMUL_NARGS) { #ifdef VT100_DEBUG @@ -957,18 +903,9 @@ wsemul_vt100_output_csi(edp, c) } void -wsemul_vt100_output(cookie, data, count, kernel) - void *cookie; - const u_char *data; - u_int count; - int kernel; +wsemul_vt100_output(void *cookie, const u_char *data, u_int count, int kernel) { struct wsemul_vt100_emuldata *edp = cookie; -#ifdef JUMP_SCROLL - const u_char *eot; - u_char curchar; - u_int cnt, pos, lines; -#endif #ifdef DIAGNOSTIC if (kernel && !edp->console) @@ -977,7 +914,7 @@ wsemul_vt100_output(cookie, data, count, kernel) if (edp->flags & VTFL_CURSORON) (*edp->emulops->cursor)(edp->emulcookie, 0, - edp->crow, edp->ccol << edp->dw); + edp->crow, edp->ccol << edp->dw); for (; count > 0; data++, count--) { #ifdef JUMP_SCROLL @@ -986,64 +923,8 @@ wsemul_vt100_output(cookie, data, count, kernel) * newlines until an escape sequence appears. */ if ((edp->state == VT100_EMUL_STATE_NORMAL || kernel) && - ROWS_BELOW == 0) { - lines = 0; - pos = edp->ccol; - for (eot = data, cnt = count; cnt != 0; eot++, cnt--) { - curchar = *eot; - /* - * Only char for which - * wsemul_vt100_output_c0c1() will switch - * to escape mode, for now. - * Revisit this when this changes... - */ - if (curchar == ASCII_ESC) - break; - - if (ISSET(edp->flags, VTFL_DECAWM)) - switch (curchar) { - case ASCII_BS: - if (pos > 0) - pos--; - break; - case ASCII_CR: - pos = 0; - break; - case ASCII_HT: - if (edp->tabs) { - pos++; - while (pos < NCOLS - 1 && - edp->tabs[pos] == 0) - pos++; - } else { - pos = (pos + 7) & ~7; - if (pos >= NCOLS) - pos = NCOLS - 1; - } - break; - default: - if ((curchar & 0x7f) < 0x20) - break; - if (pos++ >= NCOLS) { - pos = 0; - curchar = ASCII_LF; - } - break; - } - - if (curchar == ASCII_LF || - curchar == ASCII_VT || - curchar == ASCII_FF) { - if (++lines >= edp->scrreg_nrows - 1) - break; - } - } - - if (lines > 1) { - wsemul_vt100_scrollup(edp, lines); - edp->crow -= lines; - } - } + ROWS_BELOW == 0) + wsemul_vt100_jump_scroll(edp, data, count, kernel); #endif if ((*data & 0x7f) < 0x20) { @@ -1064,5 +945,72 @@ wsemul_vt100_output(cookie, data, count, kernel) if (edp->flags & VTFL_CURSORON) (*edp->emulops->cursor)(edp->emulcookie, 1, - edp->crow, edp->ccol << edp->dw); + edp->crow, edp->ccol << edp->dw); } + +#ifdef JUMP_SCROLL +void +wsemul_vt100_jump_scroll(struct wsemul_vt100_emuldata *edp, const u_char *data, + u_int count, int kernel) +{ + u_char curchar; + u_int pos, lines; + + lines = 0; + pos = edp->ccol; + for (; count != 0; data++, count--) { + curchar = *data; + /* + * Only char for which + * wsemul_vt100_output_c0c1() will switch + * to escape mode, for now. + * Revisit this when this changes... + */ + if (curchar == ASCII_ESC) + break; + + if (ISSET(edp->flags, VTFL_DECAWM)) + switch (curchar) { + case ASCII_BS: + if (pos > 0) + pos--; + break; + case ASCII_CR: + pos = 0; + break; + case ASCII_HT: + if (edp->tabs) { + pos++; + while (pos < NCOLS - 1 && + edp->tabs[pos] == 0) + pos++; + } else { + pos = (pos + 7) & ~7; + if (pos >= NCOLS) + pos = NCOLS - 1; + } + break; + default: + if ((curchar & 0x7f) < 0x20) + break; + if (pos++ >= NCOLS) { + pos = 0; + curchar = ASCII_LF; + } + break; + } + + if (curchar == ASCII_LF || + curchar == ASCII_VT || + curchar == ASCII_FF) { + if (++lines >= edp->scrreg_nrows - 1) + break; + } + } + + if (lines > 1) { + wsemul_vt100_scrollup(edp, lines); + edp->crow -= lines; + } +} +#endif diff --git a/sys/dev/wscons/wsemul_vt100_chars.c b/sys/dev/wscons/wsemul_vt100_chars.c index f62e24b49de..a45d9d9e33f 100644 --- a/sys/dev/wscons/wsemul_vt100_chars.c +++ b/sys/dev/wscons/wsemul_vt100_chars.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wsemul_vt100_chars.c,v 1.5 2007/01/07 13:31:36 miod Exp $ */ +/* $OpenBSD: wsemul_vt100_chars.c,v 1.6 2007/11/27 16:37:27 miod Exp $ */ /* $NetBSD: wsemul_vt100_chars.c,v 1.4 1999/02/20 18:20:02 drochner Exp $ */ /* @@ -75,8 +75,7 @@ static const u_int16_t dectech2uni[128] = { }; void -vt100_initchartables(edp) - struct wsemul_vt100_emuldata *edp; +vt100_initchartables(struct wsemul_vt100_emuldata *edp) { int i; @@ -129,7 +128,7 @@ static const struct { /* norwegian /danish */ {{0x0023, 0x0040, 0x00c6, 0x00d8, 0x00c5, 0x005e, 0x005f, 0x0060, 0x00e6, 0x00f8, 0x00e5, 0x007e}}, - /* portugese */ + /* portuguese */ {{0x0023, 0x0040, 0x00c3, 0x00c7, 0x00d5, 0x005e, 0x005f, 0x0060, 0x00e3, 0x00e7, 0x00f5, 0x007e}}, /* spanish */ @@ -144,9 +143,7 @@ static const struct { }; int -vt100_setnrc(edp, nrc) - struct wsemul_vt100_emuldata *edp; - int nrc; +vt100_setnrc(struct wsemul_vt100_emuldata *edp, int nrc) { int i; diff --git a/sys/dev/wscons/wsemul_vt100_keys.c b/sys/dev/wscons/wsemul_vt100_keys.c index 99cb873ab39..eac920de4cf 100644 --- a/sys/dev/wscons/wsemul_vt100_keys.c +++ b/sys/dev/wscons/wsemul_vt100_keys.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wsemul_vt100_keys.c,v 1.3 2007/11/26 16:56:42 miod Exp $ */ +/* $OpenBSD: wsemul_vt100_keys.c,v 1.4 2007/11/27 16:37:27 miod Exp $ */ /* $NetBSD: wsemul_vt100_keys.c,v 1.3 1999/04/22 20:06:02 mycroft Exp $ */ /* @@ -79,10 +79,7 @@ static const char *vt100_numpad[] = { }; int -wsemul_vt100_translate(cookie, in, out) - void *cookie; - keysym_t in; - const char **out; +wsemul_vt100_translate(void *cookie, keysym_t in, const char **out) { struct wsemul_vt100_emuldata *edp = cookie; static char c; diff --git a/sys/dev/wscons/wsemul_vt100_subr.c b/sys/dev/wscons/wsemul_vt100_subr.c index c67c0389592..c696630c7bb 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.14 2007/01/07 13:31:36 miod Exp $ */ +/* $OpenBSD: wsemul_vt100_subr.c,v 1.15 2007/11/27 16:37:27 miod Exp $ */ /* $NetBSD: wsemul_vt100_subr.c,v 1.7 2000/04/28 21:56:16 mycroft Exp $ */ /* @@ -36,10 +36,10 @@ #include <dev/wscons/wsemulvar.h> #include <dev/wscons/wsemul_vt100var.h> -int vt100_selectattribute(struct wsemul_vt100_emuldata *, int, int, int, - long *, long *); -int vt100_ansimode(struct wsemul_vt100_emuldata *, int, int); -int vt100_decmode(struct wsemul_vt100_emuldata *, int, int); +int vt100_selectattribute(struct wsemul_vt100_emuldata *, int, int, int, + long *, long *); +int vt100_ansimode(struct wsemul_vt100_emuldata *, int, int); +int vt100_decmode(struct wsemul_vt100_emuldata *, int, int); #define VTMODE_SET 33 #define VTMODE_RESET 44 #define VTMODE_REPORT 55 @@ -48,9 +48,7 @@ int vt100_decmode(struct wsemul_vt100_emuldata *, int, int); * scroll up within scrolling region */ void -wsemul_vt100_scrollup(edp, n) - struct wsemul_vt100_emuldata *edp; - int n; +wsemul_vt100_scrollup(struct wsemul_vt100_emuldata *edp, int n) { int help; @@ -60,17 +58,13 @@ wsemul_vt100_scrollup(edp, n) help = edp->scrreg_nrows - n; if (help > 0) { (*edp->emulops->copyrows)(edp->emulcookie, - edp->scrreg_startrow + n, - edp->scrreg_startrow, - help); + edp->scrreg_startrow + n, edp->scrreg_startrow, help); if (edp->dblwid) /* XXX OVERLAPS */ bcopy(&edp->dblwid[edp->scrreg_startrow + n], - &edp->dblwid[edp->scrreg_startrow], - help); + &edp->dblwid[edp->scrreg_startrow], help); } (*edp->emulops->eraserows)(edp->emulcookie, - edp->scrreg_startrow + help, n, - edp->bkgdattr); + edp->scrreg_startrow + help, n, edp->bkgdattr); if (edp->dblwid) memset(&edp->dblwid[edp->scrreg_startrow + help], 0, n); CHECK_DW; @@ -80,9 +74,7 @@ wsemul_vt100_scrollup(edp, n) * scroll down within scrolling region */ void -wsemul_vt100_scrolldown(edp, n) - struct wsemul_vt100_emuldata *edp; - int n; +wsemul_vt100_scrolldown(struct wsemul_vt100_emuldata *edp, int n) { int help; @@ -92,17 +84,13 @@ wsemul_vt100_scrolldown(edp, n) help = edp->scrreg_nrows - n; if (help > 0) { (*edp->emulops->copyrows)(edp->emulcookie, - edp->scrreg_startrow, - edp->scrreg_startrow + n, - help); + edp->scrreg_startrow, edp->scrreg_startrow + n, help); if (edp->dblwid) /* XXX OVERLAPS */ bcopy(&edp->dblwid[edp->scrreg_startrow], - &edp->dblwid[edp->scrreg_startrow + n], - help); + &edp->dblwid[edp->scrreg_startrow + n], help); } - (*edp->emulops->eraserows)(edp->emulcookie, - edp->scrreg_startrow, n, - edp->bkgdattr); + (*edp->emulops->eraserows)(edp->emulcookie, edp->scrreg_startrow, n, + edp->bkgdattr); if (edp->dblwid) memset(&edp->dblwid[edp->scrreg_startrow], 0, n); CHECK_DW; @@ -112,42 +100,37 @@ wsemul_vt100_scrolldown(edp, n) * erase in display */ void -wsemul_vt100_ed(edp, arg) - struct wsemul_vt100_emuldata *edp; - int arg; +wsemul_vt100_ed(struct wsemul_vt100_emuldata *edp, int arg) { int n; switch (arg) { - case 0: /* cursor to end */ + case 0: /* cursor to end */ ERASECOLS(edp->ccol, COLS_LEFT + 1, edp->bkgdattr); n = edp->nrows - edp->crow - 1; if (n > 0) { (*edp->emulops->eraserows)(edp->emulcookie, - edp->crow + 1, n, - edp->bkgdattr); + edp->crow + 1, n, edp->bkgdattr); if (edp->dblwid) memset(&edp->dblwid[edp->crow + 1], 0, n); } break; - case 1: /* beginning to cursor */ + case 1: /* beginning to cursor */ if (edp->crow > 0) { (*edp->emulops->eraserows)(edp->emulcookie, - 0, edp->crow, - edp->bkgdattr); + 0, edp->crow, edp->bkgdattr); if (edp->dblwid) memset(&edp->dblwid[0], 0, edp->crow); } ERASECOLS(0, edp->ccol + 1, edp->bkgdattr); break; - case 2: /* complete display */ + case 2: /* complete display */ (*edp->emulops->eraserows)(edp->emulcookie, - 0, edp->nrows, - edp->bkgdattr); + 0, edp->nrows, edp->bkgdattr); if (edp->dblwid) memset(&edp->dblwid[0], 0, edp->nrows); break; - default: + default: #ifdef VT100_PRINTUNKNOWN printf("ed(%d) unknown\n", arg); #endif @@ -160,23 +143,20 @@ wsemul_vt100_ed(edp, arg) * erase in line */ void -wsemul_vt100_el(edp, arg) - struct wsemul_vt100_emuldata *edp; - int arg; +wsemul_vt100_el(struct wsemul_vt100_emuldata *edp, int arg) { switch (arg) { - case 0: /* cursor to end */ + case 0: /* cursor to end */ ERASECOLS(edp->ccol, COLS_LEFT + 1, edp->bkgdattr); break; - case 1: /* beginning to cursor */ + case 1: /* beginning to cursor */ ERASECOLS(0, edp->ccol + 1, edp->bkgdattr); break; - case 2: /* complete line */ + case 2: /* complete line */ (*edp->emulops->erasecols)(edp->emulcookie, edp->crow, - 0, edp->ncols, - edp->bkgdattr); + 0, edp->ncols, edp->bkgdattr); break; - default: + default: #ifdef VT100_PRINTUNKNOWN printf("el(%d) unknown\n", arg); #endif @@ -188,9 +168,7 @@ wsemul_vt100_el(edp, arg) * handle commands after CSI (ESC[) */ void -wsemul_vt100_handle_csi(edp, c) - struct wsemul_vt100_emuldata *edp; - u_char c; +wsemul_vt100_handle_csi(struct wsemul_vt100_emuldata *edp, u_char c) { int n, help, flags, fgcol, bgcol; long attr, bkgdattr; @@ -199,7 +177,7 @@ wsemul_vt100_handle_csi(edp, c) switch (A3(edp->modif1, edp->modif2, c)) { case A3('>', '\0', 'c'): /* DA secondary */ wsdisplay_emulinput(edp->cbcookie, WSEMUL_VT_ID2, - sizeof(WSEMUL_VT_ID2)); + sizeof(WSEMUL_VT_ID2)); break; case A3('\0', '\0', 'J'): /* ED selective erase in display */ @@ -339,17 +317,17 @@ wsemul_vt100_handle_csi(edp, c) for (i = 0; i < edp->ncols; i++) if (edp->tabs[i]) { n = snprintf(buf, sizeof buf, "%s%d", - (ps ? "/" : ""), i + 1); + (ps ? "/" : ""), i + 1); if (n == -1) n = 0; else if (n >= sizeof buf) n = sizeof buf - 1; wsdisplay_emulinput(edp->cbcookie, - buf, n); + buf, n); ps = 1; } - } wsdisplay_emulinput(edp->cbcookie, "\033\\", 2); + } break; default: #ifdef VT100_PRINTUNKNOWN @@ -430,9 +408,10 @@ wsemul_vt100_handle_csi(edp, c) break; case 'L': /* IL insert line */ case 'M': /* DL delete line */ - n = min(DEF1_ARG(0), ROWS_BELOW + 1); - { + { int savscrstartrow, savscrnrows; + + n = min(DEF1_ARG(0), ROWS_BELOW + 1); savscrstartrow = edp->scrreg_startrow; savscrnrows = edp->scrreg_nrows; edp->scrreg_nrows -= ROWS_ABOVE; @@ -443,7 +422,7 @@ wsemul_vt100_handle_csi(edp, c) wsemul_vt100_scrollup(edp, n); edp->scrreg_startrow = savscrstartrow; edp->scrreg_nrows = savscrnrows; - } + } break; case 'P': /* DCH delete character */ n = min(DEF1_ARG(0), COLS_LEFT + 1); @@ -459,7 +438,7 @@ wsemul_vt100_handle_csi(edp, c) case 'c': /* DA primary */ if (ARG(0) == 0) wsdisplay_emulinput(edp->cbcookie, WSEMUL_VT_ID1, - sizeof(WSEMUL_VT_ID1)); + sizeof(WSEMUL_VT_ID1)); break; case 'g': /* TBC */ if (edp->tabs != NULL) @@ -571,7 +550,7 @@ wsemul_vt100_handle_csi(edp, c) if (n == -1) n = 0; else if (n >= sizeof buf) - n = sizeof buf - 1; + n = sizeof buf - 1; wsdisplay_emulinput(edp->cbcookie, buf, n); } break; @@ -634,10 +613,8 @@ wsemul_vt100_handle_csi(edp, c) * is not supported */ int -vt100_selectattribute(edp, flags, fgcol, bgcol, attr, bkgdattr) - struct wsemul_vt100_emuldata *edp; - int flags, fgcol, bgcol; - long *attr, *bkgdattr; +vt100_selectattribute(struct wsemul_vt100_emuldata *edp, int flags, int fgcol, + int bgcol, long *attr, long *bkgdattr) { int error; @@ -649,7 +626,7 @@ vt100_selectattribute(edp, flags, fgcol, bgcol, attr, bkgdattr) #endif } error = (*edp->emulops->alloc_attr)(edp->emulcookie, fgcol, bgcol, - flags & WSATTR_WSCOLORS, bkgdattr); + flags & WSATTR_WSCOLORS, bkgdattr); if (error) return (error); @@ -713,8 +690,7 @@ vt100_selectattribute(edp, flags, fgcol, bgcol, attr, bkgdattr) * told so by setting edp->dcstype to a nonzero value */ void -wsemul_vt100_handle_dcs(edp) - struct wsemul_vt100_emuldata *edp; +wsemul_vt100_handle_dcs(struct wsemul_vt100_emuldata *edp) { int i, pos; @@ -756,33 +732,31 @@ wsemul_vt100_handle_dcs(edp) } int -vt100_ansimode(edp, nr, op) - struct wsemul_vt100_emuldata *edp; - int nr, op; +vt100_ansimode(struct wsemul_vt100_emuldata *edp, int nr, int op) { int res = 0; /* default: unknown */ switch (nr) { - case 2: /* KAM keyboard locked/unlocked */ + case 2: /* KAM keyboard locked/unlocked */ break; - case 3: /* CRM control representation */ + case 3: /* CRM control representation */ break; - case 4: /* IRM insert/replace characters */ + case 4: /* IRM insert/replace characters */ if (op == VTMODE_SET) edp->flags |= VTFL_INSERTMODE; else if (op == VTMODE_RESET) edp->flags &= ~VTFL_INSERTMODE; res = ((edp->flags & VTFL_INSERTMODE) ? 1 : 2); break; - case 10: /* HEM horizontal editing (permanently reset) */ + case 10: /* HEM horizontal editing (permanently reset) */ res = 4; break; - case 12: /* SRM local echo off/on */ + case 12: /* SRM local echo off/on */ res = 4; /* permanently reset ??? */ break; - case 20: /* LNM newline = newline/linefeed */ + case 20: /* LNM newline = newline/linefeed */ break; - default: + default: #ifdef VT100_PRINTUNKNOWN printf("ANSI mode %d unknown\n", nr); #endif @@ -792,74 +766,71 @@ vt100_ansimode(edp, nr, op) } int -vt100_decmode(edp, nr, op) - struct wsemul_vt100_emuldata *edp; - int nr, op; +vt100_decmode(struct wsemul_vt100_emuldata *edp, int nr, int op) { int res = 0; /* default: unknown */ int flags; flags = edp->flags; switch (nr) { - case 1: /* DECCKM application/nomal cursor keys */ + case 1: /* DECCKM application/nomal cursor keys */ if (op == VTMODE_SET) flags |= VTFL_APPLCURSOR; else if (op == VTMODE_RESET) flags &= ~VTFL_APPLCURSOR; res = ((flags & VTFL_APPLCURSOR) ? 1 : 2); break; - case 2: /* DECANM ANSI vt100/vt52 */ + case 2: /* DECANM ANSI vt100/vt52 */ res = 3; /* permanently set ??? */ break; - case 3: /* DECCOLM 132/80 cols */ - case 4: /* DECSCLM smooth/jump scroll */ - case 5: /* DECSCNM light/dark background */ + case 3: /* DECCOLM 132/80 cols */ + case 4: /* DECSCLM smooth/jump scroll */ + case 5: /* DECSCNM light/dark background */ res = 4; /* all permanently reset ??? */ break; - case 6: /* DECOM move within/outside margins */ + case 6: /* DECOM move within/outside margins */ if (op == VTMODE_SET) flags |= VTFL_DECOM; else if (op == VTMODE_RESET) flags &= ~VTFL_DECOM; res = ((flags & VTFL_DECOM) ? 1 : 2); break; - case 7: /* DECAWM autowrap */ + case 7: /* DECAWM autowrap */ if (op == VTMODE_SET) flags |= VTFL_DECAWM; else if (op == VTMODE_RESET) flags &= ~VTFL_DECAWM; res = ((flags & VTFL_DECAWM) ? 1 : 2); break; - case 8: /* DECARM keyboard autorepeat */ + case 8: /* DECARM keyboard autorepeat */ break; - case 18: /* DECPFF print form feed */ + case 18: /* DECPFF print form feed */ break; - case 19: /* DECPEX printer extent: screen/scrolling region */ + case 19: /* DECPEX printer extent: screen/scrolling region */ break; - case 25: /* DECTCEM text cursor on/off */ + case 25: /* DECTCEM text cursor on/off */ if (op == VTMODE_SET) flags |= VTFL_CURSORON; else if (op == VTMODE_RESET) flags &= ~VTFL_CURSORON; if (flags != edp->flags) (*edp->emulops->cursor)(edp->emulcookie, - flags & VTFL_CURSORON, - edp->crow, edp->ccol); + flags & VTFL_CURSORON, edp->crow, edp->ccol); res = ((flags & VTFL_CURSORON) ? 1 : 2); break; - case 42: /* DECNRCM use 7-bit NRC / - 7/8 bit from DEC multilingual or ISO-latin-1*/ + case 42: /* DECNRCM use 7-bit NRC / + 7/8 bit from DEC multilingual or ISO-latin-1*/ if (op == VTMODE_SET) flags |= VTFL_NATCHARSET; else if (op == VTMODE_RESET) flags &= ~VTFL_NATCHARSET; res = ((flags & VTFL_NATCHARSET) ? 1 : 2); break; - case 66: /* DECNKM numeric keypad */ + case 66: /* DECNKM numeric keypad */ break; - case 68: /* DECKBUM keyboard usage data processing/typewriter */ + case 68: /* DECKBUM keyboard usage data processing/typewriter */ break; - default: + default: #ifdef VT100_PRINTUNKNOWN printf("DEC mode %d unknown\n", nr); #endif diff --git a/sys/dev/wscons/wsemul_vt100var.h b/sys/dev/wscons/wsemul_vt100var.h index ae706a25c31..f72e734761d 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.7 2007/11/26 16:56:42 miod Exp $ */ +/* $OpenBSD: wsemul_vt100var.h,v 1.8 2007/11/27 16:37:27 miod Exp $ */ /* $NetBSD: wsemul_vt100var.h,v 1.5 2000/04/28 21:56:17 mycroft Exp $ */ /* @@ -127,15 +127,15 @@ struct wsemul_vt100_emuldata { */ #define WSEMUL_VT_ID2 "\033[>24;20;0c" -void wsemul_vt100_reset(struct wsemul_vt100_emuldata *); -void wsemul_vt100_scrollup(struct wsemul_vt100_emuldata *, int); -void wsemul_vt100_scrolldown(struct wsemul_vt100_emuldata *, int); -void wsemul_vt100_ed(struct wsemul_vt100_emuldata *, int); -void wsemul_vt100_el(struct wsemul_vt100_emuldata *, int); -void wsemul_vt100_handle_csi(struct wsemul_vt100_emuldata *, u_char); -void wsemul_vt100_handle_dcs(struct wsemul_vt100_emuldata *); +void wsemul_vt100_reset(struct wsemul_vt100_emuldata *); +void wsemul_vt100_scrollup(struct wsemul_vt100_emuldata *, int); +void wsemul_vt100_scrolldown(struct wsemul_vt100_emuldata *, int); +void wsemul_vt100_ed(struct wsemul_vt100_emuldata *, int); +void wsemul_vt100_el(struct wsemul_vt100_emuldata *, int); +void wsemul_vt100_handle_csi(struct wsemul_vt100_emuldata *, u_char); +void wsemul_vt100_handle_dcs(struct wsemul_vt100_emuldata *); -int wsemul_vt100_translate(void *cookie, keysym_t, const char **); +int wsemul_vt100_translate(void *cookie, keysym_t, const char **); -void vt100_initchartables(struct wsemul_vt100_emuldata *); -int vt100_setnrc(struct wsemul_vt100_emuldata *, int); +void vt100_initchartables(struct wsemul_vt100_emuldata *); +int vt100_setnrc(struct wsemul_vt100_emuldata *, int); diff --git a/sys/dev/wscons/wsemulvar.h b/sys/dev/wscons/wsemulvar.h index 0084a76affa..3884f75830d 100644 --- a/sys/dev/wscons/wsemulvar.h +++ b/sys/dev/wscons/wsemulvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: wsemulvar.h,v 1.9 2007/11/26 16:56:42 miod Exp $ */ +/* $OpenBSD: wsemulvar.h,v 1.10 2007/11/27 16:37:27 miod Exp $ */ /* $NetBSD: wsemulvar.h,v 1.6 1999/01/17 15:46:15 drochner Exp $ */ /* @@ -61,8 +61,8 @@ extern const struct wsemul_ops wsemul_vt100_ops; const struct wsemul_ops *wsemul_pick(const char *); -/* +/* * Callbacks from the emulation code to the display interface driver. - */ + */ void wsdisplay_emulbell(void *v); void wsdisplay_emulinput(void *v, const u_char *, u_int); |