Program: 143915
Project: 143915
Buggy source:
private void putChar(char c,boolean doshowcursor){
  Dimension size;
  int rows=getRows();
  int columns=getColumns();
  int tm=getTopMargin();
  int bm=getBottomMargin();
  byte msg[];
  if (debug > 4)   System.out.println("String_Node_Str" + c + "String_Node_Str"+ ((int)c)+ "String_Node_Str"+ R+ "String_Node_Str"+ C+ "String_Node_Str"+ columns+ "String_Node_Str"+ rows);
  markLine(R,1);
  if (c > 255) {
    if (debug > 0)     System.out.println("String_Node_Str" + (int)c);
  }
switch (term_state) {
case TSTATE_DATA:
    if (!useibmcharset) {
      boolean doneflag=true;
switch (c) {
case OSC:
        osc="String_Node_Str";
      term_state=TSTATE_OSC;
    break;
case RI:
  if (R > tm)   R--;
 else   insertLine(R,1,SCROLL_DOWN);
if (debug > 1) System.out.println("String_Node_Str");
break;
case IND:
if (R == tm - 1 || R == bm || R == rows - 1) insertLine(R,1,SCROLL_UP);
 else R++;
if (debug > 1) System.out.println("String_Node_Str" + R + "String_Node_Str");
break;
case NEL:
if (R == tm - 1 || R == bm || R == rows - 1) insertLine(R,1,SCROLL_UP);
 else R++;
C=0;
if (debug > 1) System.out.println("String_Node_Str" + R + "String_Node_Str");
break;
case HTS:
Tabs[C]=1;
if (debug > 1) System.out.println("String_Node_Str");
break;
case DCS:
dcs="String_Node_Str";
term_state=TSTATE_DCS;
break;
default :
doneflag=false;
break;
}
if (doneflag) break;
}
switch (c) {
case CSI:
term_state=TSTATE_DCEQ;
break;
case ESC:
term_state=TSTATE_ESC;
lastwaslf=0;
break;
case 12:
System.out.println("String_Node_Str");
C=R=0;
break;
case '\b':
C--;
if (C < 0) C=0;
lastwaslf=0;
break;
case '\t':
do {
C++;
}
 while (C < columns && (Tabs[C] == 0));
lastwaslf=0;
break;
case '\r':
C=0;
break;
case '\n':
if (debug > 3) System.out.println("String_Node_Str" + R + "String_Node_Str"+ bm+ "String_Node_Str"+ tm+ "String_Node_Str"+ rows);
if (!vms) {
if (lastwaslf != 0 && lastwaslf != c) break;
lastwaslf=c;
}
if (R == bm || R >= rows - 1) insertLine(R,1);
 else R++;
break;
case 7:
beep();
break;
case '\016':
gl=1;
break;
case '\017':
gl=0;
break;
default :
lastwaslf=0;
if (c < 32) {
if (c != 0) if (debug > 0) System.out.println("String_Node_Str" + ((int)c));
break;
}
if (C >= columns) {
if (R < rows - 1) R++;
 else insertLine(R,SCROLL_UP);
C=0;
}
if (gx[gl] == '0') {
if (c >= '\u005f' && c <= '\u007e') {
if (debug > 3) System.out.print("String_Node_Str" + c + "String_Node_Str"+ ((short)c - 0x5f)+ "String_Node_Str");
c=DECSPECIAL[(short)c - 0x5f];
if (debug > 3) System.out.println(c + "String_Node_Str" + (int)c+ "String_Node_Str");
}
}
if (debug > 4) System.out.println("String_Node_Str" + c + "String_Node_Str"+ C+ "String_Node_Str"+ R);
if (useibmcharset) c=map_cp850_unicode(c);
if (debug > 4) System.out.println("String_Node_Str" + c + "String_Node_Str"+ C+ "String_Node_Str"+ R);
if (insertmode == 1) {
insertChar(C,R,c,attributes);
}
 else {
putChar(C,R,c,attributes);
}
C++;
break;
}
break;
case TSTATE_OSC:
if ((c < 0x20) && (c != ESC)) {
handle_osc(osc);
term_state=TSTATE_DATA;
break;
}
if (c == '\\' && osc.charAt(osc.length() - 1) == ESC) {
handle_osc(osc);
term_state=TSTATE_DATA;
break;
}
osc=osc + c;
break;
case TSTATE_ESC:
term_state=TSTATE_DATA;
switch (c) {
case '#':
term_state=TSTATE_ESCSQUARE;
break;
case 'c':
gx[0]='B';
gx[1]='0';
gx[2]='A';
gx[3]='<';
gl=0;
gr=1;
int nw=getColumns();
if (nw < 132) nw=132;
Tabs=new byte[nw];
for (int i=0; i < nw; i+=8) {
Tabs[i]=1;
}
break;
case '[':
DCEvar=0;
DCEvars[0]=0;
DCEvars[1]=0;
DCEvars[2]=0;
DCEvars[3]=0;
term_state=TSTATE_CSI;
break;
case ']':
osc="String_Node_Str";
term_state=TSTATE_OSC;
break;
case 'P':
dcs="String_Node_Str";
term_state=TSTATE_DCS;
break;
case 'E':
if (R == tm - 1 || R == bm || R == rows - 1) insertLine(R,1,SCROLL_UP);
 else R++;
C=0;
if (debug > 1) System.out.println("String_Node_Str" + R + "String_Node_Str");
break;
case 'D':
if (R == tm - 1 || R == bm || R == rows - 1) insertLine(R,1,SCROLL_UP);
 else R++;
if (debug > 1) System.out.println("String_Node_Str" + R + "String_Node_Str");
break;
case 'M':
if ((R >= tm) && (R <= bm)) insertLine(R,1,SCROLL_DOWN);
if (debug > 1) System.out.println("String_Node_Str");
break;
case 'H':
if (debug > 1) System.out.println("String_Node_Str" + C);
if (C >= columns) C=columns - 1;
Tabs[C]=1;
break;
case '=':
if (debug > 0) System.out.println("String_Node_Str");
break;
case '>':
if (debug > 0) System.out.println("String_Node_Str");
break;
case '7':
Sc=C;
Sr=R;
Sgl=gl;
Sgr=gr;
Sa=attributes;
Sgx=new char[4];
for (int i=0; i < 4; i++) Sgx[i]=gx[i];
Stm=getTopMargin();
Sbm=getBottomMargin();
if (debug > 1) System.out.println("String_Node_Str");
break;
case '8':
C=Sc;
R=Sr;
gl=Sgl;
gr=Sgr;
for (int i=0; i < 4; i++) gx[i]=Sgx[i];
setTopMargin(Stm);
setBottomMargin(Sbm);
attributes=Sa;
if (debug > 1) System.out.println("String_Node_Str");
break;
case '(':
term_state=TSTATE_SETG0;
break;
case ')':
term_state=TSTATE_SETG1;
break;
case '*':
term_state=TSTATE_SETG2;
break;
case '+':
term_state=TSTATE_SETG3;
break;
case '~':
gr=1;
break;
case 'n':
gl=2;
break;
case '}':
gr=2;
break;
case 'o':
gl=3;
break;
case '|':
gr=3;
break;
default :
System.out.println("String_Node_Str" + ((int)c) + "String_Node_Str");
break;
}
break;
case TSTATE_SETG0:
if (c != '0' && c != 'A' && c != 'B') System.out.println("String_Node_Str" + c + "String_Node_Str"+ ((int)c)+ "String_Node_Str");
 else {
if (debug > 2) System.out.println("String_Node_Str" + c + "String_Node_Str"+ ((int)c)+ "String_Node_Str");
gx[0]=c;
}
term_state=TSTATE_DATA;
break;
case TSTATE_SETG1:
if (c != '0' && c != 'A' && c != 'B') {
System.out.println("String_Node_Str" + c + "String_Node_Str"+ ((int)c)+ "String_Node_Str");
}
 else {
if (debug > 2) System.out.println("String_Node_Str" + c + "String_Node_Str"+ ((int)c)+ "String_Node_Str");
gx[1]=c;
}
term_state=TSTATE_DATA;
break;
case TSTATE_SETG2:
if (c != '0' && c != 'A' && c != 'B') System.out.println("String_Node_Str" + ((int)c) + "String_Node_Str");
 else {
if (debug > 2) System.out.println("String_Node_Str" + c + "String_Node_Str"+ ((int)c)+ "String_Node_Str");
gx[2]=c;
}
term_state=TSTATE_DATA;
break;
case TSTATE_SETG3:
if (c != '0' && c != 'A' && c != 'B') System.out.println("String_Node_Str" + ((int)c) + "String_Node_Str");
 else {
if (debug > 2) System.out.println("String_Node_Str" + c + "String_Node_Str"+ ((int)c)+ "String_Node_Str");
gx[3]=c;
}
term_state=TSTATE_DATA;
break;
case TSTATE_ESCSQUARE:
switch (c) {
case '8':
for (int i=0; i < columns; i++) for (int j=0; j < rows; j++) putChar(i,j,'E',0);
break;
default :
System.out.println("String_Node_Str" + c + "String_Node_Str");
break;
}
term_state=TSTATE_DATA;
break;
case TSTATE_DCS:
if (c == '\\' && dcs.charAt(dcs.length() - 1) == ESC) {
handle_dcs(dcs);
term_state=TSTATE_DATA;
break;
}
dcs=dcs + c;
break;
case TSTATE_DCEQ:
term_state=TSTATE_DATA;
switch (c) {
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
DCEvars[DCEvar]=DCEvars[DCEvar] * 10 + ((int)c) - 48;
term_state=TSTATE_DCEQ;
break;
case ';':
DCEvar++;
DCEvars[DCEvar]=0;
term_state=TSTATE_DCEQ;
break;
case 's':
if (true || debug > 1) System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str");
break;
case 'r':
if (true || debug > 1) System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str");
for (i=0; i <= DCEvar; i++) {
switch (DCEvars[i]) {
case 3:
size=getSize();
setScreenSize(80,rows);
break;
case 4:
break;
case 5:
break;
case 6:
moveoutsidemargins=true;
break;
case 12:
break;
case 9:
case 1000:
case 1001:
case 1002:
case 1003:
mouserpt=DCEvars[i];
break;
default :
System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str");
}
}
break;
case 'h':
if (debug > 0) System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str");
for (i=0; i <= DCEvar; i++) {
switch (DCEvars[i]) {
case 1:
KeyUp[0]="String_Node_Str";
KeyDown[0]="String_Node_Str";
KeyRight[0]="String_Node_Str";
KeyLeft[0]="String_Node_Str";
break;
case 3:
size=getSize();
setScreenSize(132,rows);
break;
case 6:
moveoutsidemargins=false;
break;
case 25:
showCursor(true);
redraw();
break;
case 9:
case 1000:
case 1001:
case 1002:
case 1003:
mouserpt=DCEvars[i];
break;
default :
System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str");
break;
}
}
break;
case 'i':
switch (DCEvars[0]) {
case 1:
if (debug > 1) System.out.println("String_Node_Str");
break;
case 4:
if (debug > 1) System.out.println("String_Node_Str");
break;
case 5:
if (debug > 1) System.out.println("String_Node_Str");
break;
}
break;
case 'l':
if (debug > 0) System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str");
for (i=0; i <= DCEvar; i++) {
switch (DCEvars[i]) {
case 1:
KeyUp[0]="String_Node_Str";
KeyDown[0]="String_Node_Str";
KeyRight[0]="String_Node_Str";
KeyLeft[0]="String_Node_Str";
break;
case 3:
size=getSize();
setScreenSize(80,rows);
break;
case 6:
moveoutsidemargins=true;
break;
case 25:
showCursor(false);
redraw();
break;
case 9:
case 1000:
case 1001:
case 1002:
case 1003:
mouserpt=0;
break;
default :
System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str");
break;
}
}
break;
case 'n':
if (debug > 0) System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str");
switch (DCEvars[0]) {
case 15:
write(((char)ESC) + "String_Node_Str",false);
System.out.println("String_Node_Str");
break;
default :
System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str");
break;
}
break;
default :
System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str"+ c+ "String_Node_Str");
break;
}
break;
case TSTATE_CSI_EX:
term_state=TSTATE_DATA;
switch (c) {
case ESC:
term_state=TSTATE_ESC;
break;
default :
System.out.println("String_Node_Str" + (int)c);
break;
}
break;
case TSTATE_CSI_DOLLAR:
term_state=TSTATE_DATA;
switch (c) {
case '}':
System.out.println("String_Node_Str" + DCEvars[0]);
statusmode=DCEvars[0];
break;
case '~':
System.out.println("String_Node_Str" + DCEvars[0]);
break;
default :
System.out.println("String_Node_Str" + c + "String_Node_Str"+ DCEvars[0]);
break;
}
break;
case TSTATE_CSI:
term_state=TSTATE_DATA;
switch (c) {
case '$':
term_state=TSTATE_CSI_DOLLAR;
break;
case '!':
term_state=TSTATE_CSI_EX;
break;
case '?':
DCEvar=0;
DCEvars[0]=0;
term_state=TSTATE_DCEQ;
break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
DCEvars[DCEvar]=DCEvars[DCEvar] * 10 + ((int)c) - 48;
term_state=TSTATE_CSI;
break;
case ';':
DCEvar++;
DCEvars[DCEvar]=0;
term_state=TSTATE_CSI;
break;
case 'c':
write(((char)ESC) + "String_Node_Str",false);
if (debug > 1) System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str");
break;
case 'q':
if (debug > 1) System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str");
break;
case 'g':
switch (DCEvars[0]) {
case 3:
int nw=getColumns();
Tabs=new byte[nw];
break;
case 0:
Tabs[C]=0;
break;
}
if (debug > 1) System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str");
break;
case 'h':
switch (DCEvars[0]) {
case 4:
insertmode=1;
break;
case 20:
System.out.println("String_Node_Str");
sendcrlf=true;
break;
default :
System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str");
break;
}
if (debug > 1) System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str");
break;
case 'i':
switch (DCEvars[0]) {
case 0:
if (debug > 1) System.out.println("String_Node_Str");
break;
case 4:
if (debug > 1) System.out.println("String_Node_Str");
break;
case 5:
if (debug > 1) System.out.println("String_Node_Str");
break;
default :
System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str");
}
break;
case 'l':
switch (DCEvars[0]) {
case 4:
insertmode=0;
break;
case 20:
System.out.println("String_Node_Str");
sendcrlf=false;
break;
default :
System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str");
break;
}
break;
case 'A':
{
int limit;
if (R > bm) limit=bm + 1;
 else if (R >= tm) {
limit=tm;
}
 else limit=0;
if (DCEvars[0] == 0) R--;
 else R-=DCEvars[0];
if (R < limit) R=limit;
if (debug > 1) System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str");
break;
}
case 'B':
{
int limit;
if (R < tm) limit=tm - 1;
 else if (R <= bm) {
limit=bm;
}
 else limit=rows - 1;
if (DCEvars[0] == 0) R++;
 else R+=DCEvars[0];
if (R > limit) R=limit;
 else {
if (debug > 2) System.out.println("String_Node_Str");
}
if (debug > 2) System.out.println("String_Node_Str" + R);
if (debug > 1) System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str"+ C+ "String_Node_Str");
break;
}
case 'C':
if (DCEvars[0] == 0) C++;
 else C+=DCEvars[0];
if (C > columns - 1) C=columns - 1;
if (debug > 1) System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str");
break;
case 'd':
R=DCEvars[0];
System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str");
break;
case 'D':
if (DCEvars[0] == 0) C--;
 else C-=DCEvars[0];
if (C < 0) C=0;
if (debug > 1) System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str");
break;
case 'r':
if (DCEvar > 0) {
R=DCEvars[1] - 1;
if (R < 0) R=rows - 1;
 else if (R >= rows) {
R=rows - 1;
}
}
 else R=rows - 1;
setBottomMargin(DCEvars[1] - 1);
if (R >= DCEvars[0]) {
R=DCEvars[0] - 1;
if (R < 0) R=0;
}
setTopMargin(DCEvars[0] - 1);
_SetCursor(0,0);
if (debug > 1) System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str"+ DCEvars[1]+ "String_Node_Str");
break;
case 'G':
C=DCEvars[0];
if (debug > 1) System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str");
break;
case 'H':
_SetCursor(DCEvars[0] - 1,DCEvars[1] - 1);
if (debug > 2) {
System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str"+ DCEvars[1]+ "String_Node_Str"+ moveoutsidemargins);
System.out.println("String_Node_Str" + R + "String_Node_Str"+ C);
}
break;
case 'f':
R=DCEvars[0] - 1;
C=DCEvars[1] - 1;
if (C < 0) C=0;
if (R < 0) R=0;
if (debug > 2) System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str"+ DCEvars[1]+ "String_Node_Str");
break;
case 'L':
if (DCEvars[0] == 0) insertLine(R,SCROLL_DOWN);
 else insertLine(R,DCEvars[0],SCROLL_DOWN);
if (debug > 1) System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str"+ R+ "String_Node_Str");
break;
case 'M':
if (debug > 1) System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str"+ R);
if (DCEvars[0] == 0) deleteLine(R);
 else for (int i=0; i < DCEvars[0]; i++) deleteLine(R);
break;
case 'K':
if (debug > 1) System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str");
switch (DCEvars[0]) {
case 0:
if (C < columns - 1) deleteArea(C,R,columns - C,1);
break;
case 1:
if (C > 0) deleteArea(0,R,C,1);
break;
case 2:
deleteArea(0,R,columns,1);
break;
}
break;
case 'J':
switch (DCEvars[0]) {
case 0:
if (R < rows - 1) deleteArea(0,R + 1,columns,rows - R - 1);
if (C < columns - 1) deleteArea(C,R,columns - C,1);
break;
case 1:
if (R > 0) deleteArea(0,0,columns,R - 1);
if (C > 0) deleteArea(0,R,C,1);
break;
case 2:
deleteArea(0,0,columns,rows);
break;
}
if (debug > 1) System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str");
break;
case '@':
if (debug > 1) System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str");
for (int i=0; i < DCEvars[0]; i++) insertChar(C,R,' ',attributes);
break;
case 'P':
if (debug > 1) System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str"+ C+ "String_Node_Str"+ R);
if (DCEvars[0] == 0) DCEvars[0]=1;
for (int i=0; i < DCEvars[0]; i++) deleteChar(C,R);
break;
case 'n':
switch (DCEvars[0]) {
case 5:
write(((char)ESC) + "String_Node_Str",false);
if (debug > 1) System.out.println("String_Node_Str");
break;
case 6:
write(((char)ESC) + "String_Node_Str" + R+ "String_Node_Str"+ C+ "String_Node_Str",false);
if (debug > 1) System.out.println("String_Node_Str");
break;
default :
if (debug > 0) System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str");
break;
}
break;
case 's':
Sc=C;
Sr=R;
Sa=attributes;
if (debug > 3) System.out.println("String_Node_Str");
break;
case 'u':
C=Sc;
R=Sr;
attributes=Sa;
if (debug > 3) System.out.println("String_Node_Str");
break;
case 'm':
if (debug > 3) System.out.print("String_Node_Str");
if (DCEvar == 0 && DCEvars[0] == 0) attributes=0;
for (i=0; i <= DCEvar; i++) {
switch (DCEvars[i]) {
case 0:
if (DCEvar > 0) attributes=0;
break;
case 4:
attributes|=UNDERLINE;
break;
case 1:
attributes|=BOLD;
break;
case 7:
attributes|=INVERT;
break;
case 5:
break;
case 25:
break;
case 27:
attributes&=~INVERT;
break;
case 24:
attributes&=~UNDERLINE;
break;
case 22:
attributes&=~BOLD;
break;
case 30:
case 31:
case 32:
case 33:
case 34:
case 35:
case 36:
case 37:
attributes&=~(0xf << 3);
attributes|=((DCEvars[i] - 30) + 1) << 3;
break;
case 39:
attributes&=~(0xf << 3);
break;
case 40:
case 41:
case 42:
case 43:
case 44:
case 45:
case 46:
case 47:
attributes&=~(0xf << 7);
attributes|=((DCEvars[i] - 40) + 1) << 7;
break;
case 49:
attributes&=~(0xf << 7);
break;
default :
System.out.println("String_Node_Str" + DCEvars[i] + "String_Node_Str");
break;
}
if (debug > 3) System.out.print("String_Node_Str" + DCEvars[i] + "String_Node_Str");
}
if (debug > 3) System.out.print("String_Node_Str" + attributes + "String_Node_Str");
break;
default :
System.out.println("String_Node_Str" + c + "String_Node_Str"+ ((int)c)+ "String_Node_Str");
break;
}
break;
default :
term_state=TSTATE_DATA;
break;
}
if (C > columns) C=columns;
if (R > rows) R=rows;
if (C < 0) C=0;
if (R < 0) R=0;
if (doshowcursor) setCursorPosition(C,R);
markLine(R,1);
}

Fixed version (ground truth):
private void putChar(char c,boolean doshowcursor){
  Dimension size;
  int rows=getRows();
  int columns=getColumns();
  int tm=getTopMargin();
  int bm=getBottomMargin();
  byte msg[];
  if (debug > 4)   System.out.println("String_Node_Str" + c + "String_Node_Str"+ ((int)c)+ "String_Node_Str"+ R+ "String_Node_Str"+ C+ "String_Node_Str"+ columns+ "String_Node_Str"+ rows);
  markLine(R,1);
  if (c > 255) {
    if (debug > 0)     System.out.println("String_Node_Str" + (int)c);
  }
switch (term_state) {
case TSTATE_DATA:
    if (!useibmcharset) {
      boolean doneflag=true;
switch (c) {
case OSC:
        osc="String_Node_Str";
      term_state=TSTATE_OSC;
    break;
case RI:
  if (R > tm)   R--;
 else   insertLine(R,1,SCROLL_DOWN);
if (debug > 1) System.out.println("String_Node_Str");
break;
case IND:
if (R == tm - 1 || R == bm || R == rows - 1) insertLine(R,1,SCROLL_UP);
 else R++;
if (debug > 1) System.out.println("String_Node_Str" + R + "String_Node_Str");
break;
case NEL:
if (R == tm - 1 || R == bm || R == rows - 1) insertLine(R,1,SCROLL_UP);
 else R++;
C=0;
if (debug > 1) System.out.println("String_Node_Str" + R + "String_Node_Str");
break;
case HTS:
Tabs[C]=1;
if (debug > 1) System.out.println("String_Node_Str");
break;
case DCS:
dcs="String_Node_Str";
term_state=TSTATE_DCS;
break;
default :
doneflag=false;
break;
}
if (doneflag) break;
}
switch (c) {
case CSI:
term_state=TSTATE_DCEQ;
break;
case ESC:
term_state=TSTATE_ESC;
lastwaslf=0;
break;
case 12:
System.out.println("String_Node_Str");
C=R=0;
break;
case '\b':
C--;
if (C < 0) C=0;
lastwaslf=0;
break;
case '\t':
do {
C++;
}
 while (C < columns && (Tabs[C] == 0));
lastwaslf=0;
break;
case '\r':
C=0;
break;
case '\n':
if (debug > 3) System.out.println("String_Node_Str" + R + "String_Node_Str"+ bm+ "String_Node_Str"+ tm+ "String_Node_Str"+ rows);
if (!vms) {
if (lastwaslf != 0 && lastwaslf != c) break;
lastwaslf=c;
}
if (R == bm || R >= rows - 1) insertLine(R,1);
 else R++;
break;
case 7:
beep();
break;
case '\016':
gl=1;
break;
case '\017':
gl=0;
break;
default :
lastwaslf=0;
if (c < 32) {
if (c != 0) if (debug > 0) System.out.println("String_Node_Str" + ((int)c));
break;
}
if (C >= columns) {
if (R < rows - 1) R++;
 else insertLine(R,SCROLL_UP);
C=0;
}
if (gx[gl] == '0') {
if (c >= '\u005f' && c <= '\u007e') {
if (debug > 3) System.out.print("String_Node_Str" + c + "String_Node_Str"+ ((short)c - 0x5f)+ "String_Node_Str");
c=DECSPECIAL[(short)c - 0x5f];
if (debug > 3) System.out.println(c + "String_Node_Str" + (int)c+ "String_Node_Str");
}
}
if (debug > 4) System.out.println("String_Node_Str" + c + "String_Node_Str"+ C+ "String_Node_Str"+ R);
if (useibmcharset) c=map_cp850_unicode(c);
if (debug > 4) System.out.println("String_Node_Str" + c + "String_Node_Str"+ C+ "String_Node_Str"+ R);
if (insertmode == 1) {
insertChar(C,R,c,attributes);
}
 else {
putChar(C,R,c,attributes);
}
C++;
break;
}
break;
case TSTATE_OSC:
if ((c < 0x20) && (c != ESC)) {
handle_osc(osc);
term_state=TSTATE_DATA;
break;
}
if (c == '\\' && osc.charAt(osc.length() - 1) == ESC) {
handle_osc(osc);
term_state=TSTATE_DATA;
break;
}
osc=osc + c;
break;
case TSTATE_ESC:
term_state=TSTATE_DATA;
switch (c) {
case '#':
term_state=TSTATE_ESCSQUARE;
break;
case 'c':
gx[0]='B';
gx[1]='0';
gx[2]='A';
gx[3]='<';
gl=0;
gr=1;
int nw=getColumns();
if (nw < 132) nw=132;
Tabs=new byte[nw];
for (int i=0; i < nw; i+=8) {
Tabs[i]=1;
}
break;
case '[':
DCEvar=0;
DCEvars[0]=0;
DCEvars[1]=0;
DCEvars[2]=0;
DCEvars[3]=0;
term_state=TSTATE_CSI;
break;
case ']':
osc="String_Node_Str";
term_state=TSTATE_OSC;
break;
case 'P':
dcs="String_Node_Str";
term_state=TSTATE_DCS;
break;
case 'E':
if (R == tm - 1 || R == bm || R == rows - 1) insertLine(R,1,SCROLL_UP);
 else R++;
C=0;
if (debug > 1) System.out.println("String_Node_Str" + R + "String_Node_Str");
break;
case 'D':
if (R == tm - 1 || R == bm || R == rows - 1) insertLine(R,1,SCROLL_UP);
 else R++;
if (debug > 1) System.out.println("String_Node_Str" + R + "String_Node_Str");
break;
case 'M':
if ((R >= tm) && (R <= bm)) insertLine(R,1,SCROLL_DOWN);
if (debug > 1) System.out.println("String_Node_Str");
break;
case 'H':
if (debug > 1) System.out.println("String_Node_Str" + C);
if (C >= columns) C=columns - 1;
Tabs[C]=1;
break;
case '=':
if (debug > 0) System.out.println("String_Node_Str");
break;
case '>':
if (debug > 0) System.out.println("String_Node_Str");
break;
case '7':
Sc=C;
Sr=R;
Sgl=gl;
Sgr=gr;
Sa=attributes;
Sgx=new char[4];
for (int i=0; i < 4; i++) Sgx[i]=gx[i];
Stm=getTopMargin();
Sbm=getBottomMargin();
if (debug > 1) System.out.println("String_Node_Str");
break;
case '8':
C=Sc;
R=Sr;
gl=Sgl;
gr=Sgr;
for (int i=0; i < 4; i++) gx[i]=Sgx[i];
setTopMargin(Stm);
setBottomMargin(Sbm);
attributes=Sa;
if (debug > 1) System.out.println("String_Node_Str");
break;
case '(':
term_state=TSTATE_SETG0;
break;
case ')':
term_state=TSTATE_SETG1;
break;
case '*':
term_state=TSTATE_SETG2;
break;
case '+':
term_state=TSTATE_SETG3;
break;
case '~':
gr=1;
break;
case 'n':
gl=2;
break;
case '}':
gr=2;
break;
case 'o':
gl=3;
break;
case '|':
gr=3;
break;
default :
System.out.println("String_Node_Str" + ((int)c) + "String_Node_Str");
break;
}
break;
case TSTATE_SETG0:
if (c != '0' && c != 'A' && c != 'B') System.out.println("String_Node_Str" + c + "String_Node_Str"+ ((int)c)+ "String_Node_Str");
 else {
if (debug > 2) System.out.println("String_Node_Str" + c + "String_Node_Str"+ ((int)c)+ "String_Node_Str");
gx[0]=c;
}
term_state=TSTATE_DATA;
break;
case TSTATE_SETG1:
if (c != '0' && c != 'A' && c != 'B') {
System.out.println("String_Node_Str" + c + "String_Node_Str"+ ((int)c)+ "String_Node_Str");
}
 else {
if (debug > 2) System.out.println("String_Node_Str" + c + "String_Node_Str"+ ((int)c)+ "String_Node_Str");
gx[1]=c;
}
term_state=TSTATE_DATA;
break;
case TSTATE_SETG2:
if (c != '0' && c != 'A' && c != 'B') System.out.println("String_Node_Str" + ((int)c) + "String_Node_Str");
 else {
if (debug > 2) System.out.println("String_Node_Str" + c + "String_Node_Str"+ ((int)c)+ "String_Node_Str");
gx[2]=c;
}
term_state=TSTATE_DATA;
break;
case TSTATE_SETG3:
if (c != '0' && c != 'A' && c != 'B') System.out.println("String_Node_Str" + ((int)c) + "String_Node_Str");
 else {
if (debug > 2) System.out.println("String_Node_Str" + c + "String_Node_Str"+ ((int)c)+ "String_Node_Str");
gx[3]=c;
}
term_state=TSTATE_DATA;
break;
case TSTATE_ESCSQUARE:
switch (c) {
case '8':
for (int i=0; i < columns; i++) for (int j=0; j < rows; j++) putChar(i,j,'E',0);
break;
default :
System.out.println("String_Node_Str" + c + "String_Node_Str");
break;
}
term_state=TSTATE_DATA;
break;
case TSTATE_DCS:
if (c == '\\' && dcs.charAt(dcs.length() - 1) == ESC) {
handle_dcs(dcs);
term_state=TSTATE_DATA;
break;
}
dcs=dcs + c;
break;
case TSTATE_DCEQ:
term_state=TSTATE_DATA;
switch (c) {
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
DCEvars[DCEvar]=DCEvars[DCEvar] * 10 + ((int)c) - 48;
term_state=TSTATE_DCEQ;
break;
case ';':
DCEvar++;
DCEvars[DCEvar]=0;
term_state=TSTATE_DCEQ;
break;
case 's':
if (true || debug > 1) System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str");
break;
case 'r':
if (true || debug > 1) System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str");
for (i=0; i <= DCEvar; i++) {
switch (DCEvars[i]) {
case 3:
size=getSize();
setScreenSize(80,rows);
break;
case 4:
break;
case 5:
break;
case 6:
moveoutsidemargins=true;
break;
case 12:
break;
case 9:
case 1000:
case 1001:
case 1002:
case 1003:
mouserpt=DCEvars[i];
break;
default :
System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str");
}
}
break;
case 'h':
if (debug > 0) System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str");
for (i=0; i <= DCEvar; i++) {
switch (DCEvars[i]) {
case 1:
KeyUp[0]="String_Node_Str";
KeyDown[0]="String_Node_Str";
KeyRight[0]="String_Node_Str";
KeyLeft[0]="String_Node_Str";
break;
case 3:
size=getSize();
setScreenSize(132,rows);
break;
case 6:
moveoutsidemargins=false;
break;
case 25:
showCursor(true);
redraw();
break;
case 9:
case 1000:
case 1001:
case 1002:
case 1003:
mouserpt=DCEvars[i];
break;
default :
System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str");
break;
}
}
break;
case 'i':
switch (DCEvars[0]) {
case 1:
if (debug > 1) System.out.println("String_Node_Str");
break;
case 4:
if (debug > 1) System.out.println("String_Node_Str");
break;
case 5:
if (debug > 1) System.out.println("String_Node_Str");
break;
}
break;
case 'l':
if (debug > 0) System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str");
for (i=0; i <= DCEvar; i++) {
switch (DCEvars[i]) {
case 1:
KeyUp[0]="String_Node_Str";
KeyDown[0]="String_Node_Str";
KeyRight[0]="String_Node_Str";
KeyLeft[0]="String_Node_Str";
break;
case 3:
size=getSize();
setScreenSize(80,rows);
break;
case 6:
moveoutsidemargins=true;
break;
case 25:
showCursor(false);
redraw();
break;
case 9:
case 1000:
case 1001:
case 1002:
case 1003:
mouserpt=0;
break;
default :
System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str");
break;
}
}
break;
case 'n':
if (debug > 0) System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str");
switch (DCEvars[0]) {
case 15:
write(((char)ESC) + "String_Node_Str",false);
System.out.println("String_Node_Str");
break;
default :
System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str");
break;
}
break;
default :
System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str"+ c+ "String_Node_Str");
break;
}
break;
case TSTATE_CSI_EX:
term_state=TSTATE_DATA;
switch (c) {
case ESC:
term_state=TSTATE_ESC;
break;
default :
System.out.println("String_Node_Str" + (int)c);
break;
}
break;
case TSTATE_CSI_DOLLAR:
term_state=TSTATE_DATA;
switch (c) {
case '}':
System.out.println("String_Node_Str" + DCEvars[0]);
statusmode=DCEvars[0];
break;
case '~':
System.out.println("String_Node_Str" + DCEvars[0]);
break;
default :
System.out.println("String_Node_Str" + c + "String_Node_Str"+ DCEvars[0]);
break;
}
break;
case TSTATE_CSI:
term_state=TSTATE_DATA;
switch (c) {
case '$':
term_state=TSTATE_CSI_DOLLAR;
break;
case '!':
term_state=TSTATE_CSI_EX;
break;
case '?':
DCEvar=0;
DCEvars[0]=0;
term_state=TSTATE_DCEQ;
break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
DCEvars[DCEvar]=DCEvars[DCEvar] * 10 + ((int)c) - 48;
term_state=TSTATE_CSI;
break;
case ';':
DCEvar++;
DCEvars[DCEvar]=0;
term_state=TSTATE_CSI;
break;
case 'c':
write(((char)ESC) + "String_Node_Str",false);
if (debug > 1) System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str");
break;
case 'q':
if (debug > 1) System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str");
break;
case 'g':
switch (DCEvars[0]) {
case 3:
int nw=getColumns();
Tabs=new byte[nw];
break;
case 0:
Tabs[C]=0;
break;
}
if (debug > 1) System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str");
break;
case 'h':
switch (DCEvars[0]) {
case 4:
insertmode=1;
break;
case 20:
System.out.println("String_Node_Str");
sendcrlf=true;
break;
default :
System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str");
break;
}
if (debug > 1) System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str");
break;
case 'i':
switch (DCEvars[0]) {
case 0:
if (debug > 1) System.out.println("String_Node_Str");
break;
case 4:
if (debug > 1) System.out.println("String_Node_Str");
break;
case 5:
if (debug > 1) System.out.println("String_Node_Str");
break;
default :
System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str");
}
break;
case 'l':
switch (DCEvars[0]) {
case 4:
insertmode=0;
break;
case 20:
System.out.println("String_Node_Str");
sendcrlf=false;
break;
default :
System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str");
break;
}
break;
case 'A':
{
int limit;
if (R > bm) limit=bm + 1;
 else if (R >= tm) {
limit=tm;
}
 else limit=0;
if (DCEvars[0] == 0) R--;
 else R-=DCEvars[0];
if (R < limit) R=limit;
if (debug > 1) System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str");
break;
}
case 'B':
{
int limit;
if (R < tm) limit=tm - 1;
 else if (R <= bm) {
limit=bm;
}
 else limit=rows - 1;
if (DCEvars[0] == 0) R++;
 else R+=DCEvars[0];
if (R > limit) R=limit;
 else {
if (debug > 2) System.out.println("String_Node_Str");
}
if (debug > 2) System.out.println("String_Node_Str" + R);
if (debug > 1) System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str"+ C+ "String_Node_Str");
break;
}
case 'C':
if (DCEvars[0] == 0) C++;
 else C+=DCEvars[0];
if (C > columns - 1) C=columns - 1;
if (debug > 1) System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str");
break;
case 'd':
R=DCEvars[0];
System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str");
break;
case 'D':
if (DCEvars[0] == 0) C--;
 else C-=DCEvars[0];
if (C < 0) C=0;
if (debug > 1) System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str");
break;
case 'r':
if (DCEvar > 0) {
R=DCEvars[1] - 1;
if (R < 0) R=rows - 1;
 else if (R >= rows) {
R=rows - 1;
}
}
 else R=rows - 1;
setBottomMargin(DCEvars[1] - 1);
if (R >= DCEvars[0]) {
R=DCEvars[0] - 1;
if (R < 0) R=0;
}
setTopMargin(DCEvars[0] - 1);
_SetCursor(0,0);
if (debug > 1) System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str"+ DCEvars[1]+ "String_Node_Str");
break;
case 'G':
C=DCEvars[0];
if (debug > 1) System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str");
break;
case 'H':
_SetCursor(DCEvars[0] - 1,DCEvars[1] - 1);
if (debug > 2) {
System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str"+ DCEvars[1]+ "String_Node_Str"+ moveoutsidemargins);
System.out.println("String_Node_Str" + R + "String_Node_Str"+ C);
}
break;
case 'f':
R=DCEvars[0] - 1;
C=DCEvars[1] - 1;
if (C < 0) C=0;
if (R < 0) R=0;
if (debug > 2) System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str"+ DCEvars[1]+ "String_Node_Str");
break;
case 'L':
if (DCEvars[0] == 0) insertLine(R,SCROLL_DOWN);
 else insertLine(R,DCEvars[0],SCROLL_DOWN);
if (debug > 1) System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str"+ R+ "String_Node_Str");
break;
case 'M':
if (debug > 1) System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str"+ R);
if (DCEvars[0] == 0) deleteLine(R);
 else for (int i=0; i < DCEvars[0]; i++) deleteLine(R);
break;
case 'K':
if (debug > 1) System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str");
switch (DCEvars[0]) {
case 0:
if (C < columns - 1) deleteArea(C,R,columns - C,1);
break;
case 1:
if (C > 0) deleteArea(0,R,C + 1,1);
break;
case 2:
deleteArea(0,R,columns,1);
break;
}
break;
case 'J':
switch (DCEvars[0]) {
case 0:
if (R < rows - 1) deleteArea(0,R + 1,columns,rows - R - 1);
if (C < columns - 1) deleteArea(C,R,columns - C,1);
break;
case 1:
if (R > 0) deleteArea(0,0,columns,R);
if (C > 0) deleteArea(0,R,C,1);
break;
case 2:
deleteArea(0,0,columns,rows);
break;
}
if (debug > 1) System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str");
break;
case '@':
if (debug > 1) System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str");
for (int i=0; i < DCEvars[0]; i++) insertChar(C,R,' ',attributes);
break;
case 'P':
if (debug > 1) System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str"+ C+ "String_Node_Str"+ R);
if (DCEvars[0] == 0) DCEvars[0]=1;
for (int i=0; i < DCEvars[0]; i++) deleteChar(C,R);
break;
case 'n':
switch (DCEvars[0]) {
case 5:
write(((char)ESC) + "String_Node_Str",false);
if (debug > 1) System.out.println("String_Node_Str");
break;
case 6:
write(((char)ESC) + "String_Node_Str" + R+ "String_Node_Str"+ C+ "String_Node_Str",false);
if (debug > 1) System.out.println("String_Node_Str");
break;
default :
if (debug > 0) System.out.println("String_Node_Str" + DCEvars[0] + "String_Node_Str");
break;
}
break;
case 's':
Sc=C;
Sr=R;
Sa=attributes;
if (debug > 3) System.out.println("String_Node_Str");
break;
case 'u':
C=Sc;
R=Sr;
attributes=Sa;
if (debug > 3) System.out.println("String_Node_Str");
break;
case 'm':
if (debug > 3) System.out.print("String_Node_Str");
if (DCEvar == 0 && DCEvars[0] == 0) attributes=0;
for (i=0; i <= DCEvar; i++) {
switch (DCEvars[i]) {
case 0:
if (DCEvar > 0) attributes=0;
break;
case 4:
attributes|=UNDERLINE;
break;
case 1:
attributes|=BOLD;
break;
case 7:
attributes|=INVERT;
break;
case 5:
break;
case 25:
break;
case 27:
attributes&=~INVERT;
break;
case 24:
attributes&=~UNDERLINE;
break;
case 22:
attributes&=~BOLD;
break;
case 30:
case 31:
case 32:
case 33:
case 34:
case 35:
case 36:
case 37:
attributes&=~(0xf << 3);
attributes|=((DCEvars[i] - 30) + 1) << 3;
break;
case 39:
attributes&=~(0xf << 3);
break;
case 40:
case 41:
case 42:
case 43:
case 44:
case 45:
case 46:
case 47:
attributes&=~(0xf << 7);
attributes|=((DCEvars[i] - 40) + 1) << 7;
break;
case 49:
attributes&=~(0xf << 7);
break;
default :
System.out.println("String_Node_Str" + DCEvars[i] + "String_Node_Str");
break;
}
if (debug > 3) System.out.print("String_Node_Str" + DCEvars[i] + "String_Node_Str");
}
if (debug > 3) System.out.print("String_Node_Str" + attributes + "String_Node_Str");
break;
default :
System.out.println("String_Node_Str" + c + "String_Node_Str"+ ((int)c)+ "String_Node_Str");
break;
}
break;
default :
term_state=TSTATE_DATA;
break;
}
if (C > columns) C=columns;
if (R > rows) R=rows;
if (C < 0) C=0;
if (R < 0) R=0;
if (doshowcursor) setCursorPosition(C,R);
markLine(R,1);
}