Navigation Menu

Skip to content

Commit

Permalink
Patched to compile with jikes.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Jun 7, 1999
1 parent 117401a commit 6613d1f
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 44 deletions.
76 changes: 38 additions & 38 deletions ANSITerminal.java
Expand Up @@ -34,8 +34,8 @@ public static boolean detectTerminal(InputStream _in, OutputStream _out)
byte sentBack = 0;

detectSequence[0] = ASCII_ESCAPE;
detectSequence[1] = '[';
detectSequence[2] = 'R';
detectSequence[1] = (byte) '[';
detectSequence[2] = (byte) 'R';

try
{
Expand Down Expand Up @@ -111,56 +111,56 @@ public void setBackColor(int newColor) throws LostCarrierException
byte[] colorSequence = new byte[5]; // ANSI sequence to be sent.

colorSequence[0] = ASCII_ESCAPE; // ANSI escape sequence...
colorSequence[1] = '[';
colorSequence[2] = '4'; // signify backcolor change...
colorSequence[1] = (byte) '[';
colorSequence[2] = (byte) '4'; // signify backcolor change...

switch (newColor)
{
case TERMCOLOR_BLACK:
case TERMCOLOR_HIBLACK:
colorSequence[3] = '0';
colorSequence[3] = (byte) '0';
break;

case TERMCOLOR_RED:
case TERMCOLOR_HIRED:
colorSequence[3] = '1';
colorSequence[3] = (byte) '1';
break;

case TERMCOLOR_GREEN:
case TERMCOLOR_HIGREEN:
colorSequence[3] = '2';
colorSequence[3] = (byte) '2';
break;

case TERMCOLOR_YELLOW:
case TERMCOLOR_HIYELLOW:
colorSequence[3] = '3';
colorSequence[3] = (byte) '3';
break;

case TERMCOLOR_BLUE:
case TERMCOLOR_HIBLUE:
colorSequence[3] = '4';
colorSequence[3] = (byte) '4';
break;

case TERMCOLOR_MAGENTA:
case TERMCOLOR_HIMAGENTA:
colorSequence[3] = '5';
colorSequence[3] = (byte) '5';
break;

case TERMCOLOR_CYAN:
case TERMCOLOR_HICYAN:
colorSequence[3] = '6';
colorSequence[3] = (byte) '6';
break;

case TERMCOLOR_WHITE:
case TERMCOLOR_HIWHITE:
colorSequence[3] = '7';
colorSequence[3] = (byte) '7';
break;

default: // bogus color.
return;
} // switch

colorSequence[4] = 'm'; // signifies color change request.
colorSequence[4] = (byte) 'm'; // signifies color change request.

send(colorSequence);
currentBackColor = newColor;
Expand All @@ -172,63 +172,63 @@ public void setForeColor(int newColor) throws LostCarrierException
byte[] colorSequence = new byte[7]; // ANSI sequence to be sent.

colorSequence[0] = ASCII_ESCAPE;
colorSequence[1] = '[';
colorSequence[1] = (byte) '[';

if (newColor >= INTENSITY_COLORS)
colorSequence[2] = '1'; // signify intensity attribute.
colorSequence[2] = (byte) '1'; // signify intensity attribute.
else
colorSequence[2] = '0'; // signify attribute reset.
colorSequence[2] = (byte) '0'; // signify attribute reset.

colorSequence[3] = ';';
colorSequence[4] = '3'; // '3' == signifies fore color.
colorSequence[3] = (byte) ';';
colorSequence[4] = (byte) '3'; // '3' == signifies fore color.

switch (newColor)
{
case TERMCOLOR_BLACK:
case TERMCOLOR_HIBLACK:
colorSequence[5] = '0';
colorSequence[5] = (byte) '0';
break;

case TERMCOLOR_RED:
case TERMCOLOR_HIRED:
colorSequence[5] = '1';
colorSequence[5] = (byte) '1';
break;

case TERMCOLOR_GREEN:
case TERMCOLOR_HIGREEN:
colorSequence[5] = '2';
colorSequence[5] = (byte) '2';
break;

case TERMCOLOR_YELLOW:
case TERMCOLOR_HIYELLOW:
colorSequence[5] = '3';
colorSequence[5] = (byte) '3';
break;

case TERMCOLOR_BLUE:
case TERMCOLOR_HIBLUE:
colorSequence[5] = '4';
colorSequence[5] = (byte) '4';
break;

case TERMCOLOR_MAGENTA:
case TERMCOLOR_HIMAGENTA:
colorSequence[5] = '5';
colorSequence[5] = (byte) '5';
break;

case TERMCOLOR_CYAN:
case TERMCOLOR_HICYAN:
colorSequence[5] = '6';
colorSequence[5] = (byte) '6';
break;

case TERMCOLOR_WHITE:
case TERMCOLOR_HIWHITE:
colorSequence[5] = '7';
colorSequence[5] = (byte) '7';
break;

default: // bogus color.
return;
} // switch

colorSequence[6] = 'm'; // signifies color change.
colorSequence[6] = (byte) 'm'; // signifies color change.

send(colorSequence);

Expand All @@ -254,7 +254,7 @@ protected int intFromByteArray(byte[] conv, int start, int len)

for (base = 1; len > -1; len--)
{
intFromASCII = conv[start + len] - '0';
intFromASCII = conv[start + len] - ((byte) '0');
retVal += (intFromASCII * base);
base *= 10;
} // for
Expand All @@ -271,16 +271,16 @@ protected int[] getPosXY() throws LostCarrierException
int rIndex = 0; // Reply array's index.

getPosSequence[0] = ASCII_ESCAPE; // set up for request.
getPosSequence[1] = '[';
getPosSequence[2] = 'R';
getPosSequence[1] = (byte) '[';
getPosSequence[2] = (byte) 'R';

send(getPosSequence); // send request position sequence.

do // get client reply.
{
reply[rIndex] = recv();
rIndex++;
} while ((reply[rIndex - 1] != 'R') && (rIndex < reply.length));
} while ((reply[rIndex - 1] != (byte) 'R') && (rIndex < reply.length));

retVal[0] = intFromByteArray(reply, 2, 2); // X position
retVal[1] = intFromByteArray(reply, 5, 2); // Y position
Expand Down Expand Up @@ -316,7 +316,7 @@ protected int intToByteArray(int iConv, byte[] bArray, int start)
int retVal = 1;

if (iConv == 0)
bArray[start] = '0';
bArray[start] = (byte) '0';
else
{
for (i = 1; i < iConv; i *= 10); // find decimal places.
Expand All @@ -325,7 +325,7 @@ protected int intToByteArray(int iConv, byte[] bArray, int start)

for (retVal = 0; i >= 1; i /= 10)
{
bArray[start + retVal] = (byte) ((iConv / i) + '0');
bArray[start + retVal] = (byte) ((iConv / i) + (byte) '0');
retVal++;
iConv %= 10;
} // for
Expand All @@ -342,15 +342,15 @@ public void setPosXY(int X, int Y) throws LostCarrierException
int seqIndex;

newPosSequence[0] = ASCII_ESCAPE;
newPosSequence[1] = '[';
newPosSequence[1] = (byte) '[';

seqIndex = intToByteArray(X, newPosSequence, 2);

newPosSequence[3 + seqIndex] = ';';
newPosSequence[3 + seqIndex] = (byte) ';';

seqIndex = intToByteArray(Y, newPosSequence, 4 + seqIndex);

newPosSequence[3] = 'H';
newPosSequence[3] = (byte) 'H';
send(newPosSequence);
} // setPosXY

Expand All @@ -360,8 +360,8 @@ public void clearTerminal() throws LostCarrierException
byte clearSequence[] = new byte[3];

clearSequence[0] = ASCII_ESCAPE;
clearSequence[1] = '2';
clearSequence[2] = 'J';
clearSequence[1] = (byte) '2';
clearSequence[2] = (byte) 'J';

send(clearSequence);
} // clearTerminal
Expand Down
8 changes: 4 additions & 4 deletions JBBS.java
Expand Up @@ -114,16 +114,16 @@ public static String readLine(int lineMax) throws IOException
Thread.yield();

readByte = (byte) System.in.read(); // chars? !!!
if (readByte == '\b') // backspace?
if (readByte == (byte) '\b') // backspace?
{
if (bytesRead > 0)
{
inLine[bytesRead] = ' ';
inLine[bytesRead] = (byte) ' ';
bytesRead--;
} // if
} // if

else if ((readByte == '\r') || (readByte == '\n'))
else if ((readByte == (byte) '\r') || (readByte == (byte) '\n'))
{
getOut = true;
System.in.skip(System.in.available()); // clear stream...
Expand Down Expand Up @@ -357,7 +357,7 @@ protected static boolean initialize(String[] args)
} // if
System.out.println("It's cool.");

System.out.print("Revving up the Connection Manager...");
System.out.print("Revving up the ConnectionManager...");
try
{
new ConnectionManager();
Expand Down
2 changes: 1 addition & 1 deletion JBBSUser.java
Expand Up @@ -157,7 +157,7 @@ public static boolean update(JBBSUser user)
// record will look like on disk.

for (i = 0; i < LEN_RECORD; i++) // initialize array.
outputter[i] = ' ';
outputter[i] = (byte) ' ';

rc = user.handle.getBytes();
System.arraycopy(rc, 0, outputter, 0, rc.length);
Expand Down
5 changes: 4 additions & 1 deletion SocketStream.java
Expand Up @@ -18,6 +18,9 @@ public abstract class SocketStream
{
// Constants...
public static final byte ASCII_BACKSPACE = 8;
public static final byte ASCII_ESCAPE = 27;
public static final byte ASCII_CR = 13;
public static final byte ASCII_LF = 10;

public static final int TERMCOLOR_BLACK = 0;
public static final int TERMCOLOR_RED = 1;
Expand Down Expand Up @@ -290,7 +293,7 @@ public String recvln(int max) throws LostCarrierException
} // if
break;

case '\r':
case ASCII_CR:
sendln();
getOut = true;
break;
Expand Down

0 comments on commit 6613d1f

Please sign in to comment.