More SGR
Color and intensity support added to SGR.
This commit is contained in:
parent
a9e0f0c165
commit
2abdc1e335
|
@ -105,7 +105,7 @@ short ansi_start_code(char c) {
|
||||||
void ansi_match_pattern(p_channel chan, p_console_data con_data) {
|
void ansi_match_pattern(p_channel chan, p_console_data con_data) {
|
||||||
char c;
|
char c;
|
||||||
short argc = 0;
|
short argc = 0;
|
||||||
int arg[MAX_ANSI_ARGS];
|
short arg[MAX_ANSI_ARGS];
|
||||||
short i, j;
|
short i, j;
|
||||||
|
|
||||||
TRACE("ansi_match_pattern");
|
TRACE("ansi_match_pattern");
|
||||||
|
@ -349,33 +349,48 @@ void ansi_dch(p_channel chan, short arg_count, short args[]) {
|
||||||
/*
|
/*
|
||||||
* Set Graphics Rendition
|
* Set Graphics Rendition
|
||||||
*/
|
*/
|
||||||
void ansi_sgr(p_channel chan, short arg_count, short args[]) {
|
void ansi_sgr(p_channel chan, short argc, short args[]) {
|
||||||
|
short foreground = 0, background = 0;
|
||||||
short i;
|
short i;
|
||||||
|
|
||||||
TRACE("ansi_sgr");
|
TRACE("ansi_sgr");
|
||||||
|
|
||||||
log_num(LOG_ERROR, "ansi_sgr", arg_count);
|
/* Get the current colors */
|
||||||
|
text_get_color(chan->dev, &foreground, &background);
|
||||||
|
|
||||||
for (i = 0; i < arg_count; i++) {
|
/* Walk through each argument code... */
|
||||||
|
for (i = 0; i < argc; i++) {
|
||||||
short code = args[i];
|
short code = args[i];
|
||||||
|
|
||||||
log_num(LOG_ERROR, "code = ", code);
|
|
||||||
|
|
||||||
if ((code >= 30) && (code <= 37)) {
|
if ((code >= 30) && (code <= 37)) {
|
||||||
short foreground = 0, background = 0;
|
|
||||||
|
|
||||||
/* Set foreground color */
|
/* Set foreground color */
|
||||||
text_get_color(chan->dev, &foreground, &background);
|
foreground = code - 30;
|
||||||
text_set_color(chan->dev, code - 30, background);
|
|
||||||
|
} else if ((code >= 90) && (code <= 97)) {
|
||||||
|
/* Set bright foreground color */
|
||||||
|
foreground = code - 82;
|
||||||
|
|
||||||
} else if ((code >= 40) && (code <= 47)) {
|
} else if ((code >= 40) && (code <= 47)) {
|
||||||
short foreground = 0, background = 0;
|
|
||||||
|
|
||||||
/* Set background color */
|
/* Set background color */
|
||||||
text_get_color(chan->dev, &foreground, &background);
|
background = code - 40;
|
||||||
text_set_color(chan->dev, foreground, code - 40);
|
|
||||||
|
} else if ((code >= 100) && (code <= 107)) {
|
||||||
|
/* Set bright background color */
|
||||||
|
background = code - 92;
|
||||||
|
|
||||||
|
} else if ((code == 0) || (code == 2) || (code == 22)) {
|
||||||
|
/* Reset, dim, and normal intensity */
|
||||||
|
foreground = foreground & 0x07;
|
||||||
|
background = background & 0x07;
|
||||||
|
|
||||||
|
} else if (code == 1) {
|
||||||
|
/* Bold intensity */
|
||||||
|
foreground = foreground | 0x08;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Set the colors */
|
||||||
|
text_set_color(chan->dev, foreground, background);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -344,7 +344,7 @@ int main(int argc, char * argv[]) {
|
||||||
|
|
||||||
initialize();
|
initialize();
|
||||||
|
|
||||||
const char * welcome = "\x1B[2J\x1B[;1HFoenix/MCP Command Line Utility... online."; // "\x1B[;2HType \"HELP\" or \"?\" for help.\n";
|
const char * welcome = "\x1B[37m\x1B[2J\x1B[;1HFoenix/\x1B[1mMCP\x1B[0m Command Line Utility... online."; // "\x1B[;2HType \"HELP\" or \"?\" for help.\n";
|
||||||
sys_chan_write(0, welcome, strlen(welcome));
|
sys_chan_write(0, welcome, strlen(welcome));
|
||||||
|
|
||||||
cli_repl(0);
|
cli_repl(0);
|
||||||
|
|
4943
src/foenixmcp.s68
4943
src/foenixmcp.s68
File diff suppressed because it is too large
Load diff
10612
src/mapfile
10612
src/mapfile
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue