mirror of
https://github.com/reactos/reactos.git
synced 2024-08-20 02:13:29 +00:00
[SACDRV]: A few more ANSI commands. Also now that I grok ANSI, CursorX and CursorY were actually back/fore colors. Also define cursor flags/attributes that SAC supports (bold, inverted, blinking).
WANTED: The fact that the SAC developers cherry-picked *which* ANSI standard and VT standard they were going to follow, threw in ANSI.SYS compatibility, and then added a bunch of bugs, makes me wonder if real people use SAC on Windows... svn path=/trunk/; revision=59826
This commit is contained in:
parent
5027e45444
commit
02ed8a9b93
|
@ -175,6 +175,13 @@
|
||||||
#define SAC_CHANNEL_FLAG_REDRAW_EVENT 0x10
|
#define SAC_CHANNEL_FLAG_REDRAW_EVENT 0x10
|
||||||
#define SAC_CHANNEL_FLAG_APPLICATION 0x20
|
#define SAC_CHANNEL_FLAG_APPLICATION 0x20
|
||||||
|
|
||||||
|
//
|
||||||
|
// Cursor Flags
|
||||||
|
//
|
||||||
|
#define SAC_CURSOR_FLAG_BLINK 1
|
||||||
|
#define SAC_CURSOR_FLAG_BOLD 2
|
||||||
|
#define SAC_CURSOR_FLAG_INVERTED 4
|
||||||
|
|
||||||
//
|
//
|
||||||
// Forward definitions
|
// Forward definitions
|
||||||
//
|
//
|
||||||
|
@ -226,6 +233,8 @@ typedef enum _SAC_ANSI_COMMANDS
|
||||||
SacEraseEndOfScreen,
|
SacEraseEndOfScreen,
|
||||||
SacEraseStartOfScreen,
|
SacEraseStartOfScreen,
|
||||||
SacEraseScreen,
|
SacEraseScreen,
|
||||||
|
SacSetCursorPosition,
|
||||||
|
SacSetScrollRegion,
|
||||||
SacSetBackgroundColor = 21,
|
SacSetBackgroundColor = 21,
|
||||||
SacSetFontColor
|
SacSetFontColor
|
||||||
} SAC_ANSI_COMMANDS;
|
} SAC_ANSI_COMMANDS;
|
||||||
|
@ -272,9 +281,9 @@ typedef struct _SAC_CHANNEL_LOCK
|
||||||
//
|
//
|
||||||
typedef struct _SAC_CURSOR_DATA
|
typedef struct _SAC_CURSOR_DATA
|
||||||
{
|
{
|
||||||
UCHAR CursorX;
|
UCHAR CursorBackColor;
|
||||||
UCHAR CursorY;
|
UCHAR CursorColor;
|
||||||
UCHAR CursorVisible;
|
UCHAR CursorFlags;
|
||||||
WCHAR CursorValue;
|
WCHAR CursorValue;
|
||||||
} SAC_CURSOR_DATA, *PSAC_CURSOR_DATA;
|
} SAC_CURSOR_DATA, *PSAC_CURSOR_DATA;
|
||||||
C_ASSERT(sizeof(SAC_CURSOR_DATA) == 6);
|
C_ASSERT(sizeof(SAC_CURSOR_DATA) == 6);
|
||||||
|
@ -403,9 +412,9 @@ typedef struct _SAC_CHANNEL
|
||||||
LONG ChannelHasNewIBufferData;
|
LONG ChannelHasNewIBufferData;
|
||||||
UCHAR CursorRow;
|
UCHAR CursorRow;
|
||||||
UCHAR CursorCol;
|
UCHAR CursorCol;
|
||||||
UCHAR CursorY;
|
UCHAR CursorColor;
|
||||||
UCHAR CursorX;
|
UCHAR CursorBackColor;
|
||||||
UCHAR CursorVisible;
|
UCHAR CursorFlags;
|
||||||
PCHAR OBuffer;
|
PCHAR OBuffer;
|
||||||
ULONG OBufferIndex;
|
ULONG OBufferIndex;
|
||||||
ULONG OBufferFirstGoodIndex;
|
ULONG OBufferFirstGoodIndex;
|
||||||
|
|
|
@ -161,6 +161,9 @@ typedef enum _VT_ANSI_ATTRIBUTES
|
||||||
|
|
||||||
#define VT_ANSI_SET_ATTRIBUTE_CHAR L'm'
|
#define VT_ANSI_SET_ATTRIBUTE_CHAR L'm'
|
||||||
#define VT_ANSI_SEPARATOR_CHAR L';'
|
#define VT_ANSI_SEPARATOR_CHAR L';'
|
||||||
|
#define VT_ANSI_HVP_CURSOR_CHAR L'f'
|
||||||
|
#define VT_ANSI_CUP_CURSOR_CHAR L'H'
|
||||||
|
#define VT_ANSI_SCROLL_CHAR L'r'
|
||||||
|
|
||||||
SAC_STATIC_ESCAPE_STRING SacStaticEscapeStrings [] =
|
SAC_STATIC_ESCAPE_STRING SacStaticEscapeStrings [] =
|
||||||
{
|
{
|
||||||
|
@ -343,8 +346,8 @@ VTUTF8ChannelConsumeEscapeSequence(IN PSAC_CHANNEL Channel,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*Sequence != VT_ANSI_SEPARATOR_CHAR) return 0;
|
if (*Sequence != VT_ANSI_SEPARATOR_CHAR) return 0;
|
||||||
Sequence++;
|
|
||||||
|
|
||||||
|
Sequence++;
|
||||||
if (!VTUTF8ChannelScanForNumber(Sequence, &Number2)) return 0;
|
if (!VTUTF8ChannelScanForNumber(Sequence, &Number2)) return 0;
|
||||||
while ((*Sequence >= L'0') && (*Sequence <= L'9')) Sequence++;
|
while ((*Sequence >= L'0') && (*Sequence <= L'9')) Sequence++;
|
||||||
|
|
||||||
|
@ -354,9 +357,9 @@ VTUTF8ChannelConsumeEscapeSequence(IN PSAC_CHANNEL Channel,
|
||||||
goto ProcessString;
|
goto ProcessString;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*Sequence == L'H')
|
if (*Sequence == VT_ANSI_CUP_CURSOR_CHAR)
|
||||||
{
|
{
|
||||||
Action = 18;
|
Action = SacSetCursorPosition;
|
||||||
goto ProcessString;
|
goto ProcessString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -364,15 +367,16 @@ VTUTF8ChannelConsumeEscapeSequence(IN PSAC_CHANNEL Channel,
|
||||||
|
|
||||||
Sequence++;
|
Sequence++;
|
||||||
|
|
||||||
if ((*Sequence == L'H') || (*Sequence == L'f'))
|
if ((*Sequence == VT_ANSI_CUP_CURSOR_CHAR) ||
|
||||||
|
(*Sequence == VT_ANSI_HVP_CURSOR_CHAR))
|
||||||
{
|
{
|
||||||
Action = 18;
|
Action = SacSetCursorPosition;
|
||||||
goto ProcessString;
|
goto ProcessString;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*Sequence == L'r')
|
if (*Sequence == VT_ANSI_SCROLL_CHAR)
|
||||||
{
|
{
|
||||||
Action = 19;
|
Action = SacSetScrollRegion;
|
||||||
goto ProcessString;
|
goto ProcessString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -394,7 +398,7 @@ ProcessString:
|
||||||
VTUTF8ChannelAssertCursor(Channel);
|
VTUTF8ChannelAssertCursor(Channel);
|
||||||
switch (Action)
|
switch (Action)
|
||||||
{
|
{
|
||||||
case 0:
|
case SacCursorUp:
|
||||||
if (Channel->CursorRow < Number)
|
if (Channel->CursorRow < Number)
|
||||||
{
|
{
|
||||||
Channel->CursorRow = 0;
|
Channel->CursorRow = 0;
|
||||||
|
@ -406,7 +410,7 @@ ProcessString:
|
||||||
VTUTF8ChannelAssertCursor(Channel);
|
VTUTF8ChannelAssertCursor(Channel);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case SacCursorDown:
|
||||||
if (Channel->CursorRow >= SAC_VTUTF8_ROW_HEIGHT)
|
if (Channel->CursorRow >= SAC_VTUTF8_ROW_HEIGHT)
|
||||||
{
|
{
|
||||||
Channel->CursorRow = SAC_VTUTF8_ROW_HEIGHT;
|
Channel->CursorRow = SAC_VTUTF8_ROW_HEIGHT;
|
||||||
|
@ -418,7 +422,7 @@ ProcessString:
|
||||||
VTUTF8ChannelAssertCursor(Channel);
|
VTUTF8ChannelAssertCursor(Channel);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case SacCursorLeft:
|
||||||
if (Channel->CursorCol < Number)
|
if (Channel->CursorCol < Number)
|
||||||
{
|
{
|
||||||
Channel->CursorCol = 0;
|
Channel->CursorCol = 0;
|
||||||
|
@ -430,7 +434,7 @@ ProcessString:
|
||||||
VTUTF8ChannelAssertCursor(Channel);
|
VTUTF8ChannelAssertCursor(Channel);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case SacCursorRight:
|
||||||
if (Channel->CursorCol >= SAC_VTUTF8_COL_WIDTH)
|
if (Channel->CursorCol >= SAC_VTUTF8_COL_WIDTH)
|
||||||
{
|
{
|
||||||
Channel->CursorCol = SAC_VTUTF8_COL_WIDTH;
|
Channel->CursorCol = SAC_VTUTF8_COL_WIDTH;
|
||||||
|
@ -442,110 +446,110 @@ ProcessString:
|
||||||
VTUTF8ChannelAssertCursor(Channel);
|
VTUTF8ChannelAssertCursor(Channel);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case SacFontNormal:
|
||||||
Channel->CursorVisible = 0;
|
Channel->CursorFlags = 0;
|
||||||
Channel->CursorX = 40;
|
Channel->CursorBackColor = SetBackColorBlack;
|
||||||
Channel->CursorY = 37;
|
Channel->CursorColor = SetColorWhite;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 5:
|
case SacFontBlink:
|
||||||
Channel->CursorVisible |= 1;
|
Channel->CursorFlags |= SAC_CURSOR_FLAG_BLINK;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 6:
|
case SacFontBlinkOff:
|
||||||
Channel->CursorVisible &= ~1;
|
Channel->CursorFlags &= ~SAC_CURSOR_FLAG_BLINK;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 7:
|
case SacFontBold:
|
||||||
Channel->CursorVisible |= 2;
|
Channel->CursorFlags |= SAC_CURSOR_FLAG_BOLD;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 8:
|
case SacFontBoldOff:
|
||||||
Channel->CursorVisible &= ~2;
|
Channel->CursorFlags &= ~SAC_CURSOR_FLAG_BOLD;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 9:
|
case SacFontInverse:
|
||||||
Channel->CursorVisible |= 4;
|
Channel->CursorFlags |= SAC_CURSOR_FLAG_INVERTED;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 10:
|
case SacFontInverseOff:
|
||||||
Channel->CursorVisible &= ~4;
|
Channel->CursorFlags &= ~SAC_CURSOR_FLAG_INVERTED;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 12:
|
case SacEraseEndOfLine:
|
||||||
for (i = Channel->CursorCol; i < SAC_VTUTF8_COL_WIDTH; i++)
|
for (i = Channel->CursorCol; i < SAC_VTUTF8_COL_WIDTH; i++)
|
||||||
{
|
{
|
||||||
Cursor[(Channel->CursorRow * SAC_VTUTF8_COL_WIDTH) +
|
Cursor[(Channel->CursorRow * SAC_VTUTF8_COL_WIDTH) +
|
||||||
(i * SAC_VTUTF8_ROW_HEIGHT)].CursorVisible = Channel->CursorVisible;
|
(i * SAC_VTUTF8_ROW_HEIGHT)].CursorFlags = Channel->CursorFlags;
|
||||||
Cursor[(Channel->CursorRow * SAC_VTUTF8_COL_WIDTH) +
|
Cursor[(Channel->CursorRow * SAC_VTUTF8_COL_WIDTH) +
|
||||||
(i * SAC_VTUTF8_ROW_HEIGHT)].CursorX = Channel->CursorY;
|
(i * SAC_VTUTF8_ROW_HEIGHT)].CursorBackColor = Channel->CursorColor;
|
||||||
Cursor[(Channel->CursorRow * SAC_VTUTF8_COL_WIDTH) +
|
Cursor[(Channel->CursorRow * SAC_VTUTF8_COL_WIDTH) +
|
||||||
(i * SAC_VTUTF8_ROW_HEIGHT)].CursorY = Channel->CursorX;
|
(i * SAC_VTUTF8_ROW_HEIGHT)].CursorColor = Channel->CursorBackColor;
|
||||||
Cursor[(Channel->CursorRow * SAC_VTUTF8_COL_WIDTH) +
|
Cursor[(Channel->CursorRow * SAC_VTUTF8_COL_WIDTH) +
|
||||||
(i * SAC_VTUTF8_ROW_HEIGHT)].CursorValue = ' ';
|
(i * SAC_VTUTF8_ROW_HEIGHT)].CursorValue = ' ';
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 13:
|
case SacEraseStartOfLine:
|
||||||
for (i = 0; i < (Channel->CursorCol + 1); i++)
|
for (i = 0; i < (Channel->CursorCol + 1); i++)
|
||||||
{
|
{
|
||||||
Cursor[(Channel->CursorRow * SAC_VTUTF8_COL_WIDTH) +
|
Cursor[(Channel->CursorRow * SAC_VTUTF8_COL_WIDTH) +
|
||||||
(i * SAC_VTUTF8_ROW_HEIGHT)].CursorVisible = Channel->CursorVisible;
|
(i * SAC_VTUTF8_ROW_HEIGHT)].CursorFlags = Channel->CursorFlags;
|
||||||
Cursor[(Channel->CursorRow * SAC_VTUTF8_COL_WIDTH) +
|
Cursor[(Channel->CursorRow * SAC_VTUTF8_COL_WIDTH) +
|
||||||
(i * SAC_VTUTF8_ROW_HEIGHT)].CursorX = Channel->CursorY;
|
(i * SAC_VTUTF8_ROW_HEIGHT)].CursorBackColor = Channel->CursorColor;
|
||||||
Cursor[(Channel->CursorRow * SAC_VTUTF8_COL_WIDTH) +
|
Cursor[(Channel->CursorRow * SAC_VTUTF8_COL_WIDTH) +
|
||||||
(i * SAC_VTUTF8_ROW_HEIGHT)].CursorY = Channel->CursorX;
|
(i * SAC_VTUTF8_ROW_HEIGHT)].CursorColor = Channel->CursorBackColor;
|
||||||
Cursor[(Channel->CursorRow * SAC_VTUTF8_COL_WIDTH) +
|
Cursor[(Channel->CursorRow * SAC_VTUTF8_COL_WIDTH) +
|
||||||
(i * SAC_VTUTF8_ROW_HEIGHT)].CursorValue = ' ';
|
(i * SAC_VTUTF8_ROW_HEIGHT)].CursorValue = ' ';
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 14:
|
case SacEraseLine:
|
||||||
for (i = 0; i < SAC_VTUTF8_COL_WIDTH; i++)
|
for (i = 0; i < SAC_VTUTF8_COL_WIDTH; i++)
|
||||||
{
|
{
|
||||||
Cursor[(Channel->CursorRow * SAC_VTUTF8_COL_WIDTH) +
|
Cursor[(Channel->CursorRow * SAC_VTUTF8_COL_WIDTH) +
|
||||||
(i * SAC_VTUTF8_ROW_HEIGHT)].CursorVisible = Channel->CursorVisible;
|
(i * SAC_VTUTF8_ROW_HEIGHT)].CursorFlags = Channel->CursorFlags;
|
||||||
Cursor[(Channel->CursorRow * SAC_VTUTF8_COL_WIDTH) +
|
Cursor[(Channel->CursorRow * SAC_VTUTF8_COL_WIDTH) +
|
||||||
(i * SAC_VTUTF8_ROW_HEIGHT)].CursorX = Channel->CursorY;
|
(i * SAC_VTUTF8_ROW_HEIGHT)].CursorBackColor = Channel->CursorColor;
|
||||||
Cursor[(Channel->CursorRow * SAC_VTUTF8_COL_WIDTH) +
|
Cursor[(Channel->CursorRow * SAC_VTUTF8_COL_WIDTH) +
|
||||||
(i * SAC_VTUTF8_ROW_HEIGHT)].CursorY = Channel->CursorX;
|
(i * SAC_VTUTF8_ROW_HEIGHT)].CursorColor = Channel->CursorBackColor;
|
||||||
Cursor[(Channel->CursorRow * SAC_VTUTF8_COL_WIDTH) +
|
Cursor[(Channel->CursorRow * SAC_VTUTF8_COL_WIDTH) +
|
||||||
(i * SAC_VTUTF8_ROW_HEIGHT)].CursorValue = ' ';
|
(i * SAC_VTUTF8_ROW_HEIGHT)].CursorValue = ' ';
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 15:
|
case SacEraseEndOfScreen:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 16:
|
case SacEraseStartOfScreen:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 17:
|
case SacEraseScreen:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 18:
|
case SacSetCursorPosition:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 19:
|
case SacSetScrollRegion:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 20:
|
case 20:
|
||||||
Channel->CursorY = Number;
|
Channel->CursorColor = Number;
|
||||||
Channel->CursorX = Number2;
|
Channel->CursorBackColor = Number2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 21:
|
case SacSetBackgroundColor:
|
||||||
Channel->CursorX = Number;
|
Channel->CursorBackColor = Number;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 22:
|
case SacSetFontColor:
|
||||||
Channel->CursorY = Number;
|
Channel->CursorColor = Number;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 23:
|
case 23:
|
||||||
Channel->CursorVisible = Number;
|
Channel->CursorFlags = Number;
|
||||||
Channel->CursorY = Number2;
|
Channel->CursorColor = Number2;
|
||||||
Channel->CursorX = Number3;
|
Channel->CursorBackColor = Number3;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -563,13 +567,13 @@ VTUTF8ChannelOInit(IN PSAC_CHANNEL Channel)
|
||||||
CHECK_PARAMETER(Channel);
|
CHECK_PARAMETER(Channel);
|
||||||
|
|
||||||
/* Set the current channel cursor parameters */
|
/* Set the current channel cursor parameters */
|
||||||
Channel->CursorVisible = 0;
|
Channel->CursorFlags = 0;
|
||||||
Channel->CursorX = 40;
|
Channel->CursorBackColor = SetBackColorBlack;
|
||||||
Channel->CursorY = 37;
|
Channel->CursorColor = SetColorWhite;
|
||||||
|
|
||||||
/* Loop the output buffer height by width */
|
/* Loop the output buffer height by width */
|
||||||
Cursor = (PSAC_CURSOR_DATA)Channel->OBuffer;
|
Cursor = (PSAC_CURSOR_DATA)Channel->OBuffer;
|
||||||
y = SAC_VTUTF8_COL_HEIGHT - 1;
|
y = SAC_VTUTF8_ROW_HEIGHT;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
x = SAC_VTUTF8_COL_WIDTH;
|
x = SAC_VTUTF8_COL_WIDTH;
|
||||||
|
@ -577,8 +581,8 @@ VTUTF8ChannelOInit(IN PSAC_CHANNEL Channel)
|
||||||
{
|
{
|
||||||
/* For every character, set the defaults */
|
/* For every character, set the defaults */
|
||||||
Cursor->CursorValue = ' ';
|
Cursor->CursorValue = ' ';
|
||||||
Cursor->CursorX = 40;
|
Cursor->CursorBackColor = SetBackColorBlack;
|
||||||
Cursor->CursorY = 38;
|
Cursor->CursorColor = SetColorWhite;
|
||||||
|
|
||||||
/* Move to the next character */
|
/* Move to the next character */
|
||||||
Cursor++;
|
Cursor++;
|
||||||
|
|
Loading…
Reference in a new issue