Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 3766 → Rev 3767

/trunk/uspace/app/bdsh/input.c
33,6 → 33,7
#include <stdlib.h>
#include <string.h>
#include <io/stream.h>
#include <console.h>
 
#include "config.h"
#include "util.h"
164,7 → 165,10
char line[INPUT_MAX];
size_t len = 0;
 
console_set_style(STYLE_EMPHASIS);
printf("%s", usr->prompt);
console_set_style(STYLE_NORMAL);
 
read_line(line, INPUT_MAX);
len = strlen(line);
/* Make sure we don't have rubbish or a C/R happy user */
/trunk/uspace/app/tester/console/console1.c
32,23 → 32,76
#include <async.h>
#include "../tester.h"
 
#include <ipc/console.h>
#include <console.h>
 
static void set_style(int fgcolor, int bgcolor)
{
int con_phone = get_cons_phone();
async_msg_2(con_phone, CONSOLE_SET_STYLE, fgcolor, bgcolor);
}
const char *color_name[] = {
[COLOR_BLACK] = "black",
[COLOR_BLUE] = "blue",
[COLOR_GREEN] = "green",
[COLOR_CYAN] = "cyan",
[COLOR_RED] = "red",
[COLOR_MAGENTA] = "magenta",
[COLOR_YELLOW] = "yellow",
[COLOR_WHITE] = "white"
};
 
char * test_console1(bool quiet)
{
set_style(0xff0000, 0xf0f0f0);
printf("Red on white background.\n");
set_style(0x008080, 0x000080);
printf("Cyan on blue background.\n");
set_style(0x000000, 0xf0f0f0);
printf("Black on white background.\n");
int i, j;
 
printf("Style test: ");
console_set_style(STYLE_NORMAL);
printf("normal ");
console_set_style(STYLE_EMPHASIS);
printf("emphasized");
console_set_style(STYLE_NORMAL);
printf(".\n");
 
printf("Foreground color test:\n");
for (j = 0; j < 2; j++) {
for (i = COLOR_BLACK; i <= COLOR_WHITE; i++) {
console_set_color(i, COLOR_WHITE,
j ? CATTR_BRIGHT : 0);
printf(" %s ", color_name[i]);
}
console_set_color(COLOR_BLACK, COLOR_WHITE, 0);
putchar('\n');
}
 
printf("Background color test:\n");
for (j = 0; j < 2; j++) {
for (i = COLOR_BLACK; i <= COLOR_WHITE; i++) {
console_set_color(COLOR_WHITE, i,
j ? CATTR_BRIGHT : 0);
printf(" %s ", color_name[i]);
}
console_set_color(COLOR_BLACK, COLOR_WHITE, 0);
putchar('\n');
}
 
printf("Now let's test RGB colors:\n");
 
for (i = 0; i < 255; i += 16) {
console_set_rgb_color(0xffffff, i << 16);
putchar('X');
}
console_set_color(COLOR_BLACK, COLOR_WHITE, 0);
putchar('\n');
 
for (i = 0; i < 255; i += 16) {
console_set_rgb_color(0xffffff, i << 8);
putchar('X');
}
console_set_color(COLOR_BLACK, COLOR_WHITE, 0);
putchar('\n');
 
for (i = 0; i < 255; i += 16) {
console_set_rgb_color(0xffffff, i);
putchar('X');
}
console_set_color(COLOR_BLACK, COLOR_WHITE, 0);
putchar('\n');
 
printf("[press a key]\n");
getchar();
 
/trunk/uspace/app/tetris/screen.c
51,8 → 51,8
#include <string.h>
#include <unistd.h>
#include <io/stream.h>
#include <console.h>
 
 
#include <async.h>
#include "screen.h"
#include "tetris.h"
76,23 → 76,16
static int con_phone;
 
 
 
static void set_style(int fgcolor, int bgcolor)
{
async_msg_2(con_phone, CONSOLE_SET_STYLE, fgcolor, bgcolor);
}
 
static void start_standout(void)
{
set_style(0xf0f0f0, 0);
console_set_rgb_color(0xf0f0f0, 0);
}
 
static void resume_normal(void)
{
set_style(0, 0xf0f0f0);
console_set_rgb_color(0, 0xf0f0f0);
}
 
 
void clear_screen(void)
{
async_msg_0(con_phone, CONSOLE_CLEAR);
/trunk/uspace/app/trace/trace.c
666,9 → 666,15
o = oper_new("flush", 0, arg_def, V_VOID, 0, resp_def);
proto_add_oper(p, CONSOLE_FLUSH, o);
 
arg_def[0] = V_INTEGER;
o = oper_new("set_style", 1, arg_def, V_INTEGER, 0, resp_def);
proto_add_oper(p, CONSOLE_SET_STYLE, o);
arg_def[0] = V_INTEGER; arg_def[1] = V_INTEGER; arg_def[2] = V_INTEGER;
o = oper_new("set_color", 3, arg_def, V_INTEGER, 0, resp_def);
proto_add_oper(p, CONSOLE_SET_COLOR, o);
arg_def[0] = V_INTEGER; arg_def[1] = V_INTEGER;
o = oper_new("set_style", 2, arg_def, V_INTEGER, 0, resp_def);
proto_add_oper(p, CONSOLE_SET_STYLE, o);
o = oper_new("set_rgb_color", 2, arg_def, V_INTEGER, 0, resp_def);
proto_add_oper(p, CONSOLE_SET_RGB_COLOR, o);
o = oper_new("cursor_visibility", 1, arg_def, V_VOID, 0, resp_def);
proto_add_oper(p, CONSOLE_CURSOR_VISIBILITY, o);