Add some documentetion to tsetmode

The names of the terminal modes supported by vt102 are (taken from the VT220
programmer reference manual):

Table 4-7 ANSI-Standardized Modes
Name  Mnemonic		    Parameter (Ps)
Error (ignored)		    -         0 (3/0)
Keyboard action		    KAM	      2 (3/2)
Insert/replace		    IRM	      4 (3/4)
Send/receive		    SRM	      12 (3/1 3/2)
Line feed/new line	    LNM       20 (3/2 3/0)

Table 4-8 ANSI-Compatible DEC Private Modes
Name  Mnemonic		  Parameter (Ps)
Error (ignored)		  -	    0 (3/0)
Cursor key		  DECCKM    1 (3/1)
ANSI/VT52		  DECANM    2 (3/2)
Column			  DECCOLM   3 (3/3)
Scroll			  DECSCLM   4 (3/4)
Screen			  DECSCNM   5 (3/5)
Origin			  DECOM	    6 (3/6)
Auto wrap		  DECAWM    7 (3/7)
Auto repeat		  DECARM    8 (3/8)
Printer form feed	  DECPFF    18 (3/1 3/8)
Printer extent		  DECPEX    19 (3/1 3/9)
Text cursor enable	  DECTCEM   25 (3/2 3/5)
National replacement character sets DECNRCM 42 (3/4 3/2)

This patch adds a comment for each one of these sequences.
---
 st.c |   26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)
master
Roberto E. Vargas Caballero 12 years ago
parent c3b6345595
commit 74d6abfee5

26
st.c

@ -1280,7 +1280,8 @@ tsetmode(bool priv, bool set, int *args, int narg) {
for(lim = args + narg; args < lim; ++args) { for(lim = args + narg; args < lim; ++args) {
if(priv) { if(priv) {
switch(*args) { switch(*args) {
case 1: break;
case 1: /* DECCKM -- Cursor key */
MODBIT(term.mode, set, MODE_APPKEYPAD); MODBIT(term.mode, set, MODE_APPKEYPAD);
break; break;
case 5: /* DECSCNM -- Reverve video */ case 5: /* DECSCNM -- Reverve video */
@ -1289,9 +1290,14 @@ tsetmode(bool priv, bool set, int *args, int narg) {
if(mode != term.mode) if(mode != term.mode)
redraw(); redraw();
break; break;
case 7: case 6: /* XXX: DECOM -- Origin */
break;
case 7: /* DECAWM -- Auto wrap */
MODBIT(term.mode, set, MODE_WRAP); MODBIT(term.mode, set, MODE_WRAP);
break; break;
case 8: /* XXX: DECARM -- Auto repeat */
break;
case 0: /* Error (IGNORED) */
case 12: /* att610 -- Start blinking cursor (IGNORED) */ case 12: /* att610 -- Start blinking cursor (IGNORED) */
break; break;
case 25: case 25:
@ -1319,6 +1325,12 @@ tsetmode(bool priv, bool set, int *args, int narg) {
tcursor((set) ? CURSOR_SAVE : CURSOR_LOAD); tcursor((set) ? CURSOR_SAVE : CURSOR_LOAD);
break; break;
default: default:
/* case 2: DECANM -- ANSI/VT52 (NOT SUPPOURTED) */
/* case 3: DECCOLM -- Column (NOT SUPPORTED) */
/* case 4: DECSCLM -- Scroll (NOT SUPPORTED) */
/* case 18: DECPFF -- Printer feed (NOT SUPPORTED) */
/* case 19: DECPEX -- Printer extent (NOT SUPPORTED) */
/* case 42: DECNRCM -- National characters (NOT SUPPORTED) */
fprintf(stderr, fprintf(stderr,
"erresc: unknown private set/reset mode %d\n", "erresc: unknown private set/reset mode %d\n",
*args); *args);
@ -1326,13 +1338,17 @@ tsetmode(bool priv, bool set, int *args, int narg) {
} }
} else { } else {
switch(*args) { switch(*args) {
case 2: case 0: /* Error (IGNORED) */
break;
case 2: /* KAM -- keyboard action */
MODBIT(term.mode, set, MODE_KBDLOCK); MODBIT(term.mode, set, MODE_KBDLOCK);
break; break;
case 4: case 4: /* IRM -- Insertion-replacement */
MODBIT(term.mode, set, MODE_INSERT); MODBIT(term.mode, set, MODE_INSERT);
break; break;
case 20: case 12: /* XXX: SRM -- Send/Receive */
break;
case 20: /* LNM -- Linefeed/new line */
MODBIT(term.mode, set, MODE_CRLF); MODBIT(term.mode, set, MODE_CRLF);
break; break;
default: default:

Loading…
Cancel
Save