fix attempt for other non ANSI sequences

This commit is contained in:
chombier 2001-04-27 15:40:35 +00:00
parent 5e0b05892c
commit b758a6fd77
1 changed files with 421 additions and 234 deletions

View File

@ -38,6 +38,7 @@
#include "wind.h" #include "wind.h"
#include "vsdata.h" #include "vsdata.h"
#include "vskeys.h" #include "vskeys.h"
#include "rsdefs.h"
#include "rsinterf.proto.h" #include "rsinterf.proto.h"
#include "rsmac.proto.h" #include "rsmac.proto.h"
#include "vsintern.proto.h" #include "vsintern.proto.h"
@ -60,7 +61,20 @@ extern WindRec *screens;
extern VSscrndata *VSscreens; extern VSscrndata *VSscreens;
#endif #endif
void syslog( int priority, const char *format, ...); extern WindRec *console;
extern void syslog( int priority, const char *format, ...);
#define CUR_DEF 0
#define CUR_NONE 1
#define CUR_UNDERLINE 2
#define CUR_LOWER_THIRD 3
#define CUR_LOWER_HALF 4
#define CUR_TWO_THIRDS 5
#define CUR_BLOCK 6
#define CUR_HWMASK 0x0f
#define CUR_SWMASK 0xfff0
void VSunload(void) {} void VSunload(void) {}
@ -92,8 +106,8 @@ void VSprON(void)
VSIw->prbuf = 0x00000000; VSIw->prbuf = 0x00000000;
VSIw->prbuf2 = 0x00; VSIw->prbuf2 = 0x00;
sprintf (VSIw->fname,"NCSA Telnet tempfile #%d",VSIwn); sprintf (VSIw->fname,"MacSSH TempFile #%d",VSIwn);
c2pstr(VSIw->fname); /* BYU 2.4.18 */ c2pstr(VSIw->fname);
if ((sts = HCreate(TempItemsVRefNum, TempItemsDirID, (StringPtr)VSIw->fname, '????', 'TEXT')) != noErr) { if ((sts = HCreate(TempItemsVRefNum, TempItemsDirID, (StringPtr)VSIw->fname, '????', 'TEXT')) != noErr) {
if (sts != dupFNErr) { if (sts != dupFNErr) {
@ -274,13 +288,18 @@ void VSem
VSAttrib *acurrent; VSAttrib *acurrent;
WindRec *screen; WindRec *screen;
Boolean tryit; Boolean tryit;
Boolean captured;
short savedX; short savedX;
short savedY; short savedY;
unsigned char savedChar;
long val;
escflg = VSIw->escflg; escflg = VSIw->escflg;
captured = false;
#ifdef DEBUG_CAPTURE #ifdef DEBUG_CAPTURE
if (TelInfo->debug) if (TelInfo->debug) {
if (VSscreens[VSIwn].captureRN) { if (VSscreens[VSIwn].captureRN) {
unsigned char *tc = c; unsigned char *tc = c;
short tctr = ctr; short tctr = ctr;
@ -289,24 +308,21 @@ void VSem
tc += ((tctr > 255) ? 255 : tctr); tc += ((tctr > 255) ? 255 : tctr);
tctr -= ((tctr > 255) ? 255 : tctr); tctr -= ((tctr > 255) ? 255 : tctr);
} }
// if debug capturing, capture and DON'T DISPLAY afterwards captured = true;
// in case the control codes being captured crash the emulator }
// return;
} }
#endif #endif
screen = &screens[findbyVS(VSIwn)]; screen = &screens[findbyVS(VSIwn)];
while (ctr > 0) while (ctr > 0) {
{
if (VSIw->prredirect) /* PR - printer redirection? */ if (VSIw->prredirect) /* PR - printer redirection? */
VSpr(&c,&ctr); /* PR -if yes, call VSpr */ VSpr(&c,&ctr); /* PR -if yes, call VSpr */
/* PR - when we return from VSpr there may (ctr!=0) É */ /* PR - when we return from VSpr there may (ctr!=0) É */
/* PR - É or may not (ctr==0) be chars left in *c to print */ /* PR - É or may not (ctr==0) be chars left in *c to print */
tryit = 0; tryit = 0;
while (escflg == 0 && ctr > 0 && *c < 32 && !tryit) while (escflg == 0 && ctr > 0 && *c < 32 && !tryit) {
{ switch (*c) {
switch (*c)
{
case 0x1b: /* esc */ case 0x1b: /* esc */
escflg++; escflg++;
break; break;
@ -339,6 +355,7 @@ void VSem
break; break;
case 0x09: /* ht */ /* Later change for versatile tabbing */ case 0x09: /* ht */ /* Later change for versatile tabbing */
VSItab(); VSItab();
if (!captured)
VScapture(c,1); VScapture(c,1);
break; break;
case 0x0a: /* lf */ case 0x0a: /* lf */
@ -346,13 +363,14 @@ void VSem
break; break;
case 0x0d: /* cr */ case 0x0d: /* cr */
VSIw->x = 0; VSIw->x = 0;
if (!captured)
VScapture(c,1); VScapture(c,1);
break; break;
case 0x0b: /* vt */ case 0x0b: /* vt */
VSIindex(); VSIindex();
break; break;
default: default:
if ( *c >= 0x18 && screen->vtemulation == 2 ) { if ( *c >= 0x10 && screen->vtemulation >= 2 ) {
tryit = 1; tryit = 1;
c--; c--;
ctr++; ctr++;
@ -362,11 +380,9 @@ void VSem
c++; c++;
ctr--; ctr--;
} }
if (escflg == 0 && ctr > 0 && (*c & 0x80) && *c < 0xA0 if (escflg == 0 && ctr > 0 && (*c & 0x80) && *c < 0xA0 && screen->vtemulation != 0) {
&& screen->vtemulation != 0) // VT220 eightbit starts here // VT220 eightbit starts here
{ switch (*c) {
switch (*c)
{
case 0x84: /* ind */ //same as ESC D case 0x84: /* ind */ //same as ESC D
VSIindex(); VSIindex();
goto ShortCut; goto ShortCut;
@ -401,9 +417,10 @@ void VSem
goto ShortCut; goto ShortCut;
} }
}//end if vt220 }//end if vt220
while (ctr > 0 && escflg == 0 && (*c >= 32 || tryit) && !((*c & 0x80) && (*c < 0xA0) while (ctr > 0 && escflg == 0 && (*c >= 32 || tryit) && !((*c & 0x80) && (*c < 0xA0)
&& screen->vtemulation != 0)) && screen->vtemulation != 0)) {
{ //loop around, printing lines of text one at a time //loop around, printing lines of text one at a time
start = &VSIw->linest[VSIw->y]->text[VSIw->x]; /* start of area needing redrawing */ start = &VSIw->linest[VSIw->y]->text[VSIw->x]; /* start of area needing redrawing */
current = start; /* where to put next char */ current = start; /* where to put next char */
if (VSIw->oldScrollback) if (VSIw->oldScrollback)
@ -415,14 +432,12 @@ void VSem
offend = 0; /* wrapped to next line (boolean) */ offend = 0; /* wrapped to next line (boolean) */
extra = 0; /* overwriting last character of line */ extra = 0; /* overwriting last character of line */
sx = VSIw->x; /* starting column of area needing redrawing */ sx = VSIw->x; /* starting column of area needing redrawing */
if (VSIw->x > VSIw->maxwidth)
{ if (VSIw->x > VSIw->maxwidth) {
if (VSIw->DECAWM) if (VSIw->DECAWM) { // wrap to next line
{ // wrap to next line
VSIw->x = 0; VSIw->x = 0;
VSIindex(); VSIindex();
} } else //stay at right margin
else //stay at right margin
VSIw->x = VSIw->maxwidth; VSIw->x = VSIw->maxwidth;
current = start = &VSIw->linest[VSIw->y]->text[VSIw->x]; current = start = &VSIw->linest[VSIw->y]->text[VSIw->x];
@ -432,10 +447,9 @@ void VSem
sx = VSIw->x; sx = VSIw->x;
} /* if */ } /* if */
while (ctr > 0 && (*c >= 32 || tryit) && offend == 0 && !((*c & 0x80) && *c < 0xA0 while (ctr > 0 && (*c >= 32 || tryit) && offend == 0 && !((*c & 0x80) && *c < 0xA0
&& screen->vtemulation != 0)) && screen->vtemulation != 0)) {
{//Write characters on a single line //Write characters on a single line
VSIw->lastchar = *c; VSIw->lastchar = *c;
@ -446,26 +460,25 @@ void VSem
*acurrent = attrib; *acurrent = attrib;
c++; c++;
ctr--; ctr--;
if (VSIw->x < VSIw->maxwidth) //advance the cursor position if (VSIw->x < VSIw->maxwidth) {
{ //advance the cursor position
acurrent++; acurrent++;
current++; current++;
VSIw->x++; VSIw->x++;
} } else {
else //hit right margin //hit right margin
{ if (VSIw->DECAWM) {
if (VSIw->DECAWM) //autowrap to start of next line //autowrap to start of next line
{
VSIw->x++; VSIw->x++;
offend = 1; // terminate inner loop offend = 1; // terminate inner loop
} } else {
else //stay at right margin //stay at right margin
{
VSIw->x = VSIw->maxwidth; VSIw->x = VSIw->maxwidth;
extra = 1; // cursor position doesn't advance extra = 1; // cursor position doesn't advance
} }
} }
} //we've got a line full of text in the virtual screen } //we've got a line full of text in the virtual screen
//now update the screen to show what we've done //now update the screen to show what we've done
extra += VSIw->x - sx; extra += VSIw->x - sx;
if (insert) { if (insert) {
@ -476,13 +489,13 @@ void VSem
if (!VSIclip(&sxCopy, &yCopy, &x2, &y2, &extraCopy, &offset)) if (!VSIclip(&sxCopy, &yCopy, &x2, &y2, &extraCopy, &offset))
RSdraw(VSIwn, sxCopy,yCopy, VSIw->attrib,extraCopy,(char *) (start + offset)); RSdraw(VSIwn, sxCopy,yCopy, VSIw->attrib,extraCopy,(char *) (start + offset));
} }
if (!captured)
VScapture((unsigned char *) start, extra); VScapture((unsigned char *) start, extra);
} /* while */ } /* while */
while((ctr > 0) && (escflg == 1)) while ( escflg == 1 && ctr > 0 ) {
{ /* basic escape sequence processing */ /* basic escape sequence processing */
switch (*c) switch (*c) {
{
case 0x08: case 0x08:
VSIw->x--; VSIw->x--;
if (VSIw->x < 0) if (VSIw->x < 0)
@ -491,6 +504,7 @@ void VSem
case '[': /* csi */ case '[': /* csi */
VSIapclear(); VSIapclear();
escflg++; escflg++;
VSIw->escflags = 0;
break; break;
case '7': case '7':
VSIsave(); VSIsave();
@ -550,10 +564,10 @@ void VSem
c++; c++;
ctr--; ctr--;
} /* while */ } /* while */
while ((escflg == 2) && (ctr > 0))
{ /* "control sequence" processing */ while ( escflg == 2 && ctr > 0 ) {
switch (*c) /* "control sequence" processing */
{ switch (*c) {
case 0x08: case 0x08:
VSIw->x--; VSIw->x--;
if (VSIw->x < 0) if (VSIw->x < 0)
@ -575,47 +589,134 @@ void VSem
VSIw->parms[VSIw->parmptr] = VSIw->parms[VSIw->parmptr] * 10; VSIw->parms[VSIw->parmptr] = VSIw->parms[VSIw->parmptr] * 10;
VSIw->parms[VSIw->parmptr] += *c - '0'; VSIw->parms[VSIw->parmptr] += *c - '0';
break; break;
case '?': case '?':
/* DEC-private control sequence */ /* DEC-private control sequence */
VSIw->parms[VSIw->parmptr++] = -2; VSIw->parms[VSIw->parmptr++] = -2;
break; break;
case ';': case ';':
/* parameter separator */ /* parameter separator */
VSIw->parmptr++; VSIw->parmptr++;
break; break;
case 'A': /* cursor up */ case 'A': /* cursor up */
if (VSIw->parms[0]<1) VSIw->y--; /* BYU */ sx = VSIw->parms[0];
else VSIw->y-=VSIw->parms[0]; /* BYU */ if (sx < 1) sx = 1;
if ( VSIw->y < 0 ) VSIw->y=0; /* BYU */ VSIw->y -= sx;
if (VSIw->y < 0) VSIw->y = 0; /* BYU */
if (VSIw->y < VSIw->top) /* NCSA: SB */ if (VSIw->y < VSIw->top) /* NCSA: SB */
VSIw->y = VSIw->top; /* NCSA: SB */ VSIw->y = VSIw->top; /* NCSA: SB */
VSIrange(); VSIrange();
VSIflush(); // RAB BetterTelnet 2.0b3 VSIflush(); // RAB BetterTelnet 2.0b3
goto ShortCut; /* BYU 2.4.12 */ goto ShortCut; /* BYU 2.4.12 */
case 'X':
/* Erases characters at the cursor position and the next n-1 characters */
/* A parameter of 0 or 1 causes a single character to be erased */
/* Character attributes are set to normal */
/* The cursor remains in the same position */
if ( VSIw->parms[0] == 0 )
VSIw->parms[0] = 1;
savedX = VSIw->x;
savedY = VSIw->y;
savedChar = VSIw->lastchar;
VSIw->lastchar = ' ';
/* leave current attribute for linux */
if (screen->vtemulation != 3) {
VSIw->attrib &= 0x80; // all off
}
// FALL-THROUGH
case 'b': /* repeat last char n times ? */
while ( VSIw->parms[0] > 0 ) {
int i;
int len = VSIw->parms[0];
unsigned char repeatbuf[256];
short savecaptureRN;
if ( len > sizeof(repeatbuf) )
len = sizeof(repeatbuf);
VSIw->parms[0] -= len;
for (i = 0; i < len; ++i)
repeatbuf[i] = VSIw->lastchar;
VSIw->escflg = 0;
/* disable capture of already captured data */
savecaptureRN = VSscreens[VSIwn].captureRN;
VSscreens[VSIwn].captureRN = 0;
VSem(repeatbuf, len);
VSscreens[VSIwn].captureRN = savecaptureRN;
}
if (*c == 'X') {
VSIw->x = savedX;
VSIw->y = savedY;
VSIw->lastchar = savedChar;
}
goto ShortCut;
case 'B': /* cursor down */ case 'B': /* cursor down */
if (VSIw->parms[0]<1) VSIw->y++; /* BYU */ sx = VSIw->parms[0];
else VSIw->y+=VSIw->parms[0]; /* BYU */ if (sx < 1) sx = 1;
VSIw->y += sx;
if (VSIw->y > VSIw->bottom) /* NCSA: SB */ if (VSIw->y > VSIw->bottom) /* NCSA: SB */
VSIw->y = VSIw->bottom; /* NCSA: SB */ VSIw->y = VSIw->bottom; /* NCSA: SB */
VSIrange(); VSIrange();
VSIflush(); // RAB BetterTelnet 2.0b3 VSIflush(); // RAB BetterTelnet 2.0b3
goto ShortCut; /* BYU 2.4.12 */ goto ShortCut; /* BYU 2.4.12 */
case 'C': /* cursor right */ case 'C': /* cursor right */
if (VSIw->parms[0] < 1) sx = VSIw->parms[0];
VSIw->x++; if (sx < 1) sx = 1;
else if (VSIw->DECAWM && VSIw->x >= VSIw->maxwidth) {
VSIw->x += VSIw->parms[0]; // autowrap
if (VSIw->y >= VSIw->lines)
goto ShortCut;
VSIw->y++;
VSIw->x = (VSIw->x > VSIw->maxwidth) ? 0 : -1;
}
VSIw->x += sx;
VSIrange(); VSIrange();
if (VSIw->x > VSIw->maxwidth) if (VSIw->x > VSIw->maxwidth)
VSIw->x = VSIw->maxwidth; VSIw->x = VSIw->maxwidth;
goto ShortCut; /* BYU 2.4.12 */ goto ShortCut; /* BYU 2.4.12 */
case 'd': /* Y cursor position ? */
VSIw->y = VSIw->parms[0] - 1;
if (VSIw->DECAWM && VSIw->x > VSIw->maxwidth)
VSIw->x = 0;
if (VSIw->y < 0)
VSIw->y = 0;
if (VSIw->y > VSIw->lines)
VSIw->y = VSIw->lines;
goto ShortCut;
case 'D': /* cursor left */ case 'D': /* cursor left */
if (VSIw->parms[0] < 1) sx = VSIw->parms[0];
VSIw->x--; if (sx < 1) sx = 1;
else if (VSIw->DECAWM && VSIw->x <= 0) {
VSIw->x -= VSIw->parms[0]; // autowrap
if (VSIw->y <= 0)
goto ShortCut;
VSIw->y--;
VSIw->x = VSIw->maxwidth + 1;
}
VSIw->x -= sx;
VSIrange(); VSIrange();
goto ShortCut; /* BYU 2.4.12 */ goto ShortCut; /* BYU 2.4.12 */
case 'G': /* X cursor position ? */
if (VSIw->DECAWM && VSIw->x > VSIw->maxwidth) {
// autowrap
if (VSIw->y >= VSIw->lines)
goto ShortCut;
VSIw->y++;
}
VSIw->x = VSIw->parms[0] - 1;
if (VSIw->x < 0)
VSIw->x = 0;
if (VSIw->x > VSIw->maxwidth)
VSIw->x = VSIw->maxwidth;
goto ShortCut;
case 'f': case 'f':
case 'H': case 'H':
/* absolute cursor positioning */ /* absolute cursor positioning */
@ -640,6 +741,7 @@ void VSem
if (VSIw->y != VSIw->bottom) VSIflush(); // RAB BetterTelnet 2.0b3 if (VSIw->y != VSIw->bottom) VSIflush(); // RAB BetterTelnet 2.0b3
goto ShortCut; /* BYU 2.4.12 */ goto ShortCut; /* BYU 2.4.12 */
case 'i': /* PR: media copy */ case 'i': /* PR: media copy */
if (VSIw->parms[VSIw->parmptr]==5) { /* PR */ if (VSIw->parms[VSIw->parmptr]==5) { /* PR */
/*c++; ctr--; */ /* PR */ /*c++; ctr--; */ /* PR */
@ -649,24 +751,7 @@ void VSem
} /* PR */ } /* PR */
escflg = 0; /* PR */ escflg = 0; /* PR */
break; /* PR */ break; /* PR */
case 'K':
/* erase to beginning/end/whole of line */
switch (VSIw->parms[0])
{
case -1:
case 0:
VSIeeol();
break;
case 1:
VSIebol();
break;
case 2:
VSIel(-1);
break;
default:
goto ShortCut; /* BYU 2.4.12 */
} /* switch */
goto ShortCut; /* BYU 2.4.12 */
case 'J': case 'J':
/* erase to beginning/end/whole of screen */ /* erase to beginning/end/whole of screen */
switch (VSIw->parms[0]) switch (VSIw->parms[0])
@ -685,7 +770,40 @@ void VSem
goto ShortCut; /* BYU 2.4.12 */ goto ShortCut; /* BYU 2.4.12 */
} /* switch */ } /* switch */
goto ShortCut; /* BYU 2.4.12 */ goto ShortCut; /* BYU 2.4.12 */
case 'K':
/* erase to beginning/end/whole of line */
switch (VSIw->parms[0])
{
case -1:
case 0:
VSIeeol();
break;
case 1:
VSIebol();
break;
case 2:
VSIel(-1);
break;
default:
goto ShortCut; /* BYU 2.4.12 */
} /* switch */
goto ShortCut; /* BYU 2.4.12 */
case 'm': case 'm':
#if 0
if (VSIw->parms[0] == -2) {
/* clear selection => unused */
/*
clear_selection();
if (par[0])
complement_mask = par[0]<<8 | par[1];
else
complement_mask = s_complement_mask;
*/
goto ShortCut;
}
#endif
/* set/clear attributes */ /* set/clear attributes */
{ {
short temp = 0; short temp = 0;
@ -693,29 +811,30 @@ void VSem
if (VSIw->parms[VSIw->parmptr] < 0) if (VSIw->parms[VSIw->parmptr] < 0)
VSIw->parms[VSIw->parmptr] = 0; VSIw->parms[VSIw->parmptr] = 0;
while (temp <= VSIw->parmptr) while (temp <= VSIw->parmptr) {
{
short p = VSIw->parms[temp]; short p = VSIw->parms[temp];
if (p == 0) { if (p == 0) {
VSIw->attrib &= 0x80; // all off VSIw->attrib &= 0x80; // all off
} else if (p > 0 && p < 8 ) { } else if (p > 0 && p < 8 ) {
VSIw->attrib |= VSa(p); // set an attribute VSIw->attrib |= VSa(p); // set an attribute
} else if (p >= 10 && p < 20 ) { } else if (p >= 10 && p < 20 ) {
/* 10 : Primary (default) font */ // 10 : Primary (default) font
/* 11..19 : alternate fonts */ // 11..19 : alternate fonts
} else if (p > 20 && p < 28) { } else if (p > 20 && p < 28) {
VSIw->attrib &= ~VSa(p - 20); // clear an attribute VSIw->attrib &= ~VSa(p - 20); // clear an attribute
} else if (screen->ANSIgraphics) { } else if (screen->ANSIgraphics) {
if (p >= 30 && p < 38) { if (p >= 30 && p < 38) {
VSIw->attrib = (VSIw->attrib & 0xf8ff) | ((p-30)<<8) | 0x0800; VSIw->attrib = VSansifg((VSIw->attrib & 0xf0ff) | ((p- 30)<< 8));
} else if (p >= 38 && p <= 39) { } else if (p >= 38 && p < 40) { // Turn off foreground color
/* Turn off foreground color */ VSIw->attrib &= 0xfffef0ff;
VSIw->attrib &= 0xf0ff;
} else if (p >= 40 && p < 48) { } else if (p >= 40 && p < 48) {
VSIw->attrib = (VSIw->attrib & 0x8fff) | ((p-40)<<12) | 0x8000; VSIw->attrib = VSansibg((VSIw->attrib & 0x0fff) | ((p- 40)<<12));
} else if (p >= 48 && p <= 49) { } else if (p >= 48 && p < 50) { // Turn off background color
/* Turn off background color */ VSIw->attrib &= 0xfffd0fff;
VSIw->attrib &= 0x0fff; } else if (p >= 90 && p < 98) {
VSIw->attrib = VSansifg2((VSIw->attrib & 0xf0ff) | ((p- 90)<< 8));
} else if (p >= 100 && p < 108) {
VSIw->attrib = VSansibg2((VSIw->attrib & 0x0fff) | ((p-100)<<12));
} }
} }
temp++; temp++;
@ -723,64 +842,99 @@ void VSem
} }
goto ShortCut; /* BYU 2.4.12 */ goto ShortCut; /* BYU 2.4.12 */
/* NONO: 'ansi' Term undocumented sequences */
case 'X': /* repeat last char n times without moving cursor ? */
savedX = VSIw->x;
savedY = VSIw->y;
case 'b': /* repeat last char n times ? */
while ( VSIw->parms[0] > 0 ) {
int i;
int len = VSIw->parms[0];
unsigned char repeatbuf[256];
if ( len > sizeof(repeatbuf) )
len = sizeof(repeatbuf);
VSIw->parms[0] -= len;
for (i = 0; i < len; ++i)
repeatbuf[i] = VSIw->lastchar;
VSIw->escflg = 0;
VSem(repeatbuf, len);
}
if (*c == 'X') {
VSIw->x = savedX;
VSIw->y = savedY;
}
goto ShortCut;
case 'G': /* X cursor position ? */
VSIw->x = VSIw->parms[0] - 1;
if (VSIw->x < 0)
VSIw->x = 0;
if (VSIw->x > VSIw->maxwidth)
VSIw->x = VSIw->maxwidth;
goto ShortCut;
case 'd': /* Y cursor position ? */
VSIw->y = VSIw->parms[0] - 1;
if (VSIw->DECAWM && VSIw->x > VSIw->maxwidth)
VSIw->x = 0;
if (VSIw->y < 0)
VSIw->y = 0;
if (VSIw->y > VSIw->lines)
VSIw->y = VSIw->lines;
goto ShortCut;
case 'S': /* what is this one ? */
goto ShortCut;
/* NONO: 'ansi' Term undocumented sequences */
case 'q':
/* flash dem LEDs. What LEDs? */
goto ShortCut; /* BYU 2.4.12 */
case 'c':
VTsendident();
goto ShortCut; /* BYU 2.4.12 */
case 'n': case 'n':
switch (VSIw->parms[0]) if ( VSIw->parms[0] == -2 ) {
{ switch ( VSIw->parms[1] ) {
case 15: /* (request for printer status) */
VTsendprintstat();
break;
case 25: /* request for UDK (use defined keys) status */
VTsendudkstat();
break;
}
} else {
switch (VSIw->parms[0]) {
case 5: case 5:
VTsendstat(); VTsendstat();
break; break;
case 6: case 6:
VTsendpos(); VTsendpos();
break; break;
} /* switch */ }
}
goto ShortCut;
case 'S': /* what is this one ? */
goto ShortCut;
case '"':
/* start Compatibility Level (DECSCL) */
VSIw->escflags |= 2;
break;
case 'p':
/* set the compatibility level of the terminal */
if ((VSIw->escflags & 2)) {
if ( VSIw->parms[0] == 61 ) {
// Set terminal for level 1 compatibility (VT100 mode)
// FIXME
} else if ( VSIw->parms[0] == 62 ) {
if ( VSIw->parms[1] == -1 || VSIw->parms[1] == 0 || VSIw->parms[1] == 2 ) {
// Set terminal for level 2 compatibility (VT200 mode, 8-bit controls).
// FIXME
} else if ( VSIw->parms[1] == 1 ) {
// Set terminal for level 2 compatibility (VT200 mode, 7-bit controls).
// FIXME
}
}
}
goto ShortCut;
case 'q':
/* flash dem LEDs. What LEDs? */
goto ShortCut; /* BYU 2.4.12 */
case '>':
/* maybe secondary ident request */
VSIw->escflags |= 1;
break;
case 'c':
if ( VSIw->parms[0] == -2 ) { /* not the same meaning !!! */
/* set cursor_type */
val = CUR_DEF;
if ( VSIw->parms[1] >= 0 ) {
val = VSIw->parms[1];
if ( VSIw->parms[2] > 0 ) {
val = VSIw->parms[2]<<8;
if ( VSIw->parms[3] > 0 )
val = VSIw->parms[3]<<16;
}
}
switch ( val ) {
case CUR_DEF: val = gApplicationPrefs->CursorType; break;
case CUR_NONE: val = NOCURSOR; break;
case CUR_UNDERLINE: val = UNDERSCORECURSOR; break;
case CUR_LOWER_THIRD: val = LOWER_THIRDCURSOR; break;
case CUR_LOWER_HALF: val = LOWER_HALFCURSOR; break;
case CUR_TWO_THIRDS: val = TWO_THIRDSCURSOR; break;
case CUR_BLOCK: val = BLOCKCURSOR; break;
//case CUR_HWMASK:
//case CUR_SWMASK:
default: val = -1;
}
if ( val >= 0 ) {
RSsetcurstype(VSIwn, val);
}
} else {
if (!(VSIw->escflags & 1)) {
VTsendident();
} else {
VTsendsecondaryident();
}
}
goto ShortCut; /* BYU 2.4.12 */ goto ShortCut; /* BYU 2.4.12 */
case 'L': case 'L':
if (VSIw->parms[0] < 1) if (VSIw->parms[0] < 1)
@ -856,26 +1010,37 @@ void VSem
goto ShortCut; /* BYU 2.4.12 */ goto ShortCut; /* BYU 2.4.12 */
case '!': /* BYU 2.4.12 - More private DEC stuff? */ case '!': /* BYU 2.4.12 - More private DEC stuff? */
case '\'': /* BYU 2.4.12 - More private DEC stuff? */ case '\'': /* BYU 2.4.12 - More private DEC stuff? */
case '\"': /* BYU 2.4.12 - More private DEC stuff? */ // case '\"': /* BYU 2.4.12 - More private DEC stuff? */
escflg++; /* BYU 2.4.12 */ escflg++; /* BYU 2.4.12 */
break; /* BYU 2.4.12 */ break; /* BYU 2.4.12 */
default: /* Dang blasted strays... */ default: /* Dang blasted strays... */
if (screen != console) {
sx = VSIwn;
syslog(0, "unknown csi : 0x%x\n", *c);
VSvalids(sx);
}
goto ShortCut; /* BYU 2.4.12 */ goto ShortCut; /* BYU 2.4.12 */
} /* switch */ } /* switch */
c++; c++;
ctr--; ctr--;
} /* while */ } /* while */
while ((escflg == 3) && (ctr > 0)) while ( escflg == 3 && ctr > 0 ) {
{ /* "#" handling */ /* "#" handling */
/* no support for double-width and double-height characters yet */ switch (*c) {
switch (*c)
{
case 0x08: case 0x08:
VSIw->x--; VSIw->x--;
if (VSIw->x < 0) if (VSIw->x < 0)
VSIw->x = 0; VSIw->x = 0;
break; break;
case '3': /* Double Height Line (DECDHL) Top Half */
goto ShortCut;
case '4': /* Double Height Line (DECDHL) Bottom Half */
goto ShortCut;
case '5': /* Single-Width Line (DECSWL) */
goto ShortCut;
case '6': /* Double-Width Line (DECDWL) */
goto ShortCut;
case '8': /* alignment display */ case '8': /* alignment display */
VTalign(); VTalign();
goto ShortCut; /* BYU 2.4.12 */ goto ShortCut; /* BYU 2.4.12 */
@ -886,10 +1051,9 @@ void VSem
ctr--; ctr--;
} /* while */ } /* while */
while ((escflg == 4) && (ctr > 0)) while ( escflg == 4 && ctr > 0 ) {
{ /* "(" handling (selection of G0 character set) */ /* "(" handling (selection of G0 character set) */
switch (*c) switch (*c) {
{
case 0x08: case 0x08:
VSIw->x--; VSIw->x--;
if (VSIw->x < 0) if (VSIw->x < 0)
@ -915,10 +1079,9 @@ void VSem
ctr--; ctr--;
} /* while */ } /* while */
while ((escflg == 5) && (ctr > 0)) while ( escflg == 5 && ctr > 0 ) {
{ /* ")" handling (selection of G1 character set) */ /* ")" handling (selection of G1 character set) */
switch (*c) switch (*c) {
{
case 0x08: case 0x08:
VSIw->x--; VSIw->x--;
if (VSIw->x < 0) if (VSIw->x < 0)
@ -946,16 +1109,29 @@ void VSem
// Handle XTerm rename functions, code contributed by Bill Rausch // Handle XTerm rename functions, code contributed by Bill Rausch
// Modified by JMB to handle ESC]2; case as well. // Modified by JMB to handle ESC]2; case as well.
if( (escflg >= 6) && (ctr > 0) ) { if ( escflg >= 6 && escflg < 9 && ctr > 0 ) {
static char *tmp; static char *tmp;
static Str255 newname; static Str255 newname;
if( (escflg == 6) && ((*c == '0') || (*c == '2'))) { if ( escflg == 6 ) {
if ( *c == '0' || *c == '2') {
escflg++; escflg++;
c++; c++;
ctr--; ctr--;
} else if ( *c == 'P') { /* palette escape sequence */
escflg = 9;
c++;
ctr--;
} else if ( *c == 'R') { /* reset palette */
// FIXME: RESTORE PREVIOUS SAVED COLORS
//reset_palette(currcons);
goto ShortCut;
} else {
goto ShortCut;
} }
if( (escflg == 7 ) && (ctr > 0) && (*c == ';') ) { }
if ( escflg == 7 && ctr > 0 && *c == ';' ) {
ctr--; ctr--;
c++; c++;
escflg++; escflg++;
@ -963,19 +1139,17 @@ void VSem
tmp = (char *)&newname[1]; tmp = (char *)&newname[1];
} }
while( (escflg == 8) && (ctr > 0) && (*c != 07) && (*c != 033)) { while ( escflg == 8 && ctr > 0 && *c != 7 && *c != 033) {
if(*newname < 255) if (*newname < 255) {
{
*tmp++ = *c; *tmp++ = *c;
(*newname)++; (*newname)++;
} }
c++; c++;
ctr--; ctr--;
} }
if( (escflg == 8) && (*c == 07 || *c == 033) && (ctr > 0) ) { if ( escflg == 8 && ctr > 0 && (*c == 7 || *c == 033) ) {
set_new_window_name( newname, RSgetwindow(VSIwn) ); set_new_window_name( newname, RSgetwindow(VSIwn) );
if(*c != 07) if (*c != 07) {
{
/* This will be undone in the ShortCut below. */ /* This will be undone in the ShortCut below. */
c--; c--;
ctr++; ctr++;
@ -984,30 +1158,43 @@ void VSem
} }
} /* if */ } /* if */
/* /* Linux */
if ( escflg == 9 && ctr > 0 ) {
if ( (*c>='0'&&*c<='9') || (*c>='A'&&*c<='F') || (*c>='a'&&*c<='f') ) {
VSIw->parms[VSIw->parmptr++] = (*c>'9' ? (*c&0xDF)-'A'+10 : *c-'0');
if ( VSIw->parmptr == 7 ) {
// FIXME: MUST SAVE PREVIOUS COLORS FOR RESTORE
RGBColor newColor;
newColor.red = 16 * VSIw->parms[1] + VSIw->parms[2];
newColor.green = 16 * VSIw->parms[3] + VSIw->parms[4];
newColor.blue = 16 * VSIw->parms[5] + VSIw->parms[6];
while( (escflg == 8) && (ctr > 0) && (*c != 07) ) { if (screen != console) {
*tmp++ = *c++; sx = VSIwn;
ctr--; syslog(0, "palette escape sequence\n");
(*newname)++; VSvalids(sx);
} }
if( (escflg == 8) && (*c == 07) && (ctr > 0) ) {
set_new_window_name( newname, RSgetwindow(VSIwn) ); RSsetcolors(VSIwn, VSIw->parms[0], &newColor);
goto ShortCut; goto ShortCut;
} }
} /* if */ } else {
goto ShortCut;
}
}
/* Linux */
if ( escflg > 2 && ctr > 0 ) {
if ((escflg > 2) && (ctr > 0))
{
ShortCut: /* BYU 2.4.12 - well, sacrificing style for speed */ ShortCut: /* BYU 2.4.12 - well, sacrificing style for speed */
if ((VSIw->possibleForce)&&(*c != 'H')) //CCP better forcesave if ( VSIw->possibleForce && *c != 'H' ) //CCP better forcesave
VSIw->possibleForce = FALSE; VSIw->possibleForce = FALSE;
escflg = 0; escflg = 0;
c++; c++;
ctr--; ctr--;
} /* if */ }
} /* while (ctr > 0) */ } /* while (ctr > 0) */
VSIw->escflg = escflg; VSIw->escflg = escflg;
} /* VSem */
} /* VSem */