extractedLnx/linux-2.6.9/drivers/char/vt.c_do_con_trol.c
static void do_con_trol(struct tty_struct *tty, unsigned int currcons, int c)
{
/*
* Control characters can be used in the _middle_
* of an escape sequence.
*/
switch (c) {
case 0:
return;
case 7:
if (bell_duration)
kd_mksound(bell_pitch, bell_duration);
return;
case 8:
bs(currcons);
return;
case 9:
pos -= (x << 1);
while (x < video_num_columns - 1) {
x++;
if (tab_stop[x >> 5] & (1 << (x & 31)))
break;
}
pos += (x << 1);
return;
case 10: case 11: case 12:
lf(currcons);
if (!is_kbd(lnm))
return;
case 13:
cr(currcons);
return;
case 14:
charset = 1;
translate = set_translate(G1_charset,currcons);
disp_ctrl = 1;
return;
case 15:
charset = 0;
translate = set_translate(G0_charset,currcons);
disp_ctrl = 0;
return;
case 24: case 26:
vc_state = ESnormal;
return;
case 27:
vc_state = ESesc;
return;
case 127:
del(currcons);
return;
case 128+27:
vc_state = ESsquare;
return;
}
switch(vc_state) {
case ESesc:
vc_state = ESnormal;
switch (c) {
case '[':
vc_state = ESsquare;
return;
case ']':
vc_state = ESnonstd;
return;
case '%':
vc_state = ESpercent;
return;
case 'E':
cr(currcons);
lf(currcons);
return;
case 'M':
ri(currcons);
return;
case 'D':
lf(currcons);
return;
case 'H':
tab_stop[x >> 5] |= (1 << (x & 31));
return;
case 'Z':
respond_ID(tty);
return;
case '7':
save_cur(currcons);
return;
case '8':
restore_cur(currcons);
return;
case '(':
vc_state = ESsetG0;
return;
case ')':
vc_state = ESsetG1;
return;
case '#':
vc_state = EShash;
return;
case 'c':
reset_terminal(currcons,1);
return;
case '>': /* Numeric keypad */
clr_kbd(kbdapplic);
return;
case '=': /* Appl. keypad */
set_kbd(kbdapplic);
return;
}
return;
case ESnonstd:
if (c=='P') { /* palette escape sequence */
for (npar=0; npar<NPAR; npar++)
par[npar] = 0 ;
npar = 0 ;
vc_state = ESpalette;
return;
} else if (c=='R') { /* reset palette */
reset_palette(currcons);
vc_state = ESnormal;
} else
vc_state = ESnormal;
return;
case ESpalette:
if ( (c>='0'&&c<='9') || (c>='A'&&c<='F') || (c>='a'&&c<='f') ) {
par[npar++] = (c>'9' ? (c&0xDF)-'A'+10 : c-'0') ;
if (npar==7) {
int i = par[0]*3, j = 1;
palette[i] = 16*par[j++];
palette[i++] += par[j++];
palette[i] = 16*par[j++];
palette[i++] += par[j++];
palette[i] = 16*par[j++];
palette[i] += par[j];
set_palette(currcons);
vc_state = ESnormal;
}
} else
vc_state = ESnormal;
return;
case ESsquare:
for(npar = 0 ; npar < NPAR ; npar++)
par[npar] = 0;
npar = 0;
vc_state = ESgetpars;
if (c == '[') { /* Function key */
vc_state=ESfunckey;
return;
}
ques = (c=='?');
if (ques)
return;
case ESgetpars:
if (c==';' && npar<NPAR-1) {
npar++;
return;
} else if (c>='0' && c<='9') {
par[npar] *= 10;
par[npar] += c-'0';
return;
} else vc_state=ESgotpars;
case ESgotpars:
vc_state = ESnormal;
switch(c) {
case 'h':
set_mode(currcons,1);
return;
case 'l':
set_mode(currcons,0);
return;
case 'c':
if (ques) {
if (par[0])
cursor_type = par[0] | (par[1]<<8) | (par[2]<<16);
else
cursor_type = CUR_DEFAULT;
return;
}
break;
case 'm':
if (ques) {
clear_selection();
if (par[0])
complement_mask = par[0]<<8 | par[1];
else
complement_mask = s_complement_mask;
return;
}
break;
case 'n':
if (!ques) {
if (par[0] == 5)
status_report(tty);
else if (par[0] == 6)
cursor_report(currcons,tty);
}
return;
}
if (ques) {
ques = 0;
return;
}
switch(c) {
case 'G': case '`':
if (par[0]) par[0]--;
gotoxy(currcons,par[0],y);
return;
case 'A':
if (!par[0]) par[0]++;
gotoxy(currcons,x,y-par[0]);
return;
case 'B': case 'e':
if (!par[0]) par[0]++;
gotoxy(currcons,x,y+par[0]);
return;
case 'C': case 'a':
if (!par[0]) par[0]++;
gotoxy(currcons,x+par[0],y);
return;
case 'D':
if (!par[0]) par[0]++;
gotoxy(currcons,x-par[0],y);
return;
case 'E':
if (!par[0]) par[0]++;
gotoxy(currcons,0,y+par[0]);
return;
case 'F':
if (!par[0]) par[0]++;
gotoxy(currcons,0,y-par[0]);
return;
case 'd':
if (par[0]) par[0]--;
gotoxay(currcons,x,par[0]);
return;
case 'H': case 'f':
if (par[0]) par[0]--;
if (par[1]) par[1]--;
gotoxay(currcons,par[1],par[0]);
return;
case 'J':
csi_J(currcons,par[0]);
return;
case 'K':
csi_K(currcons,par[0]);
return;
case 'L':
csi_L(currcons,par[0]);
return;
case 'M':
csi_M(currcons,par[0]);
return;
case 'P':
csi_P(currcons,par[0]);
return;
case 'c':
if (!par[0])
respond_ID(tty);
return;
case 'g':
if (!par[0])
tab_stop[x >> 5] &= ~(1 << (x & 31));
else if (par[0] == 3) {
tab_stop[0] =
tab_stop[1] =
tab_stop[2] =
tab_stop[3] =
tab_stop[4] = 0;
}
return;
case 'm':
csi_m(currcons);
return;
case 'q': /* DECLL - but only 3 leds */
/* map 0,1,2,3 to 0,1,2,4 */
if (par[0] < 4)
setledstate(kbd_table + currcons,
(par[0] < 3) ? par[0] : 4);
return;
case 'r':
if (!par[0])
par[0]++;
if (!par[1])
par[1] = video_num_lines;
/* Minimum allowed region is 2 lines */
if (par[0] < par[1] &&
par[1] <= video_num_lines) {
top=par[0]-1;
bottom=par[1];
gotoxay(currcons,0,0);
}
return;
case 's':
save_cur(currcons);
return;
case 'u':
restore_cur(currcons);
return;
case 'X':
csi_X(currcons, par[0]);
return;
case '@':
csi_at(currcons,par[0]);
return;
case ']': /* setterm functions */
setterm_command(currcons);
return;
}
return;
case ESpercent:
vc_state = ESnormal;
switch (c) {
case '@': /* defined in ISO 2022 */
utf = 0;
return;
case 'G': /* prelim official escape code */
case '8': /* retained for compatibility */
utf = 1;
return;
}
return;
case ESfunckey:
vc_state = ESnormal;
return;
case EShash:
vc_state = ESnormal;
if (c == '8') {
/* DEC screen alignment test. kludge :-) */
video_erase_char =
(video_erase_char & 0xff00) | 'E';
csi_J(currcons, 2);
video_erase_char =
(video_erase_char & 0xff00) | ' ';
do_update_region(currcons, origin, screenbuf_size/2);
}
return;
case ESsetG0:
if (c == '0')
G0_charset = GRAF_MAP;
else if (c == 'B')
G0_charset = LAT1_MAP;
else if (c == 'U')
G0_charset = IBMPC_MAP;
else if (c == 'K')
G0_charset = USER_MAP;
if (charset == 0)
translate = set_translate(G0_charset,currcons);
vc_state = ESnormal;
return;
case ESsetG1:
if (c == '0')
G1_charset = GRAF_MAP;
else if (c == 'B')
G1_charset = LAT1_MAP;
else if (c == 'U')
G1_charset = IBMPC_MAP;
else if (c == 'K')
G1_charset = USER_MAP;
if (charset == 1)
translate = set_translate(G1_charset,currcons);
vc_state = ESnormal;
return;
default:
vc_state = ESnormal;
}
}
Generated by GNU enscript 1.6.4.