Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 4210 → Rev 4211

/trunk/uspace/lib/libc/include/sys/types.h
42,6 → 42,8
typedef long off_t;
typedef int mode_t;
 
typedef int32_t wchar_t;
 
typedef volatile uint8_t ioport8_t;
typedef volatile uint16_t ioport16_t;
typedef volatile uint32_t ioport32_t;
/trunk/uspace/srv/console/console.c
103,7 → 103,7
/** Buffer for receiving data via the CONSOLE_WRITE call from the client. */
static char cwrite_buf[CWRITE_BUF_SIZE];
 
static void fb_putchar(char c, int row, int col);
static void fb_putchar(wchar_t c, int row, int col);
 
 
/** Find unused virtual console.
251,18 → 251,18
 
 
/** Print a character to the active VC with buffering. */
static void fb_putchar(char c, int row, int col)
static void fb_putchar(wchar_t c, int row, int col)
{
async_msg_3(fb_info.phone, FB_PUTCHAR, c, row, col);
}
 
/** Process a character from the client (TTY emulation). */
static void write_char(int console, char key)
static void write_char(int console, wchar_t ch)
{
bool flush_cursor = false;
screenbuffer_t *scr = &(connections[console].screenbuffer);
 
switch (key) {
switch (ch) {
case '\n':
fb_pending_flush();
flush_cursor = true;
287,7 → 287,7
if (console == active_console)
cell_mark_changed(scr->position_y, scr->position_x);
 
screenbuffer_putchar(scr, key);
screenbuffer_putchar(scr, ch);
scr->position_x++;
}
 
/trunk/uspace/srv/console/screenbuffer.c
43,13 → 43,13
* @param scr screenbuffer
* @param c stored character
*/
void screenbuffer_putchar(screenbuffer_t *scr, char c)
void screenbuffer_putchar(screenbuffer_t *scr, wchar_t ch)
{
keyfield_t *field;
 
field = get_field_at(scr, scr->position_x, scr->position_y);
 
field->character = c;
field->character = ch;
field->attrs = scr->attrs;
}
 
/trunk/uspace/srv/console/screenbuffer.h
36,6 → 36,7
#define __SCREENBUFFER_H__
 
#include <stdint.h>
#include <sys/types.h>
 
#define DEFAULT_FOREGROUND 0x0 /**< default console foreground color */
#define DEFAULT_BACKGROUND 0xf0f0f0 /**< default console background color */
70,7 → 71,7
 
/** One field on screen. It contain one character and its attributes. */
typedef struct {
char character; /**< Character itself */
wchar_t character; /**< Character itself */
attrs_t attrs; /**< Character`s attributes */
} keyfield_t;
 
91,7 → 92,7
* @param y position on screen
* @return keyfield structure with character and its attributes on x,y
*/
static inline keyfield_t *get_field_at(screenbuffer_t *scr, unsigned int x, unsigned int y)
static inline keyfield_t *get_field_at(screenbuffer_t *scr, unsigned int x, unsigned int y)
{
return scr->buffer + x + ((y + scr->top_line) % scr->size_y) * scr->size_x;
}
116,7 → 117,7
}
 
 
void screenbuffer_putchar(screenbuffer_t *scr, char c);
void screenbuffer_putchar(screenbuffer_t *scr, wchar_t c);
screenbuffer_t *screenbuffer_init(screenbuffer_t *scr, int size_x, int size_y);
 
void screenbuffer_clear(screenbuffer_t *scr);
/trunk/uspace/srv/fb/serial_console.c
102,6 → 102,11
putc_function(*(str++));
}
 
void serial_putchar(wchar_t ch)
{
(*putc_function)(ch);
}
 
void serial_goto(const unsigned int row, const unsigned int col)
{
if ((row > scr_height) || (col > scr_width))
256,7 → 261,7
a1 = &field->attrs;
if (!attrs_same(*a0, *a1))
serial_set_attrs(a1);
(*putc_function)(field->character);
serial_putchar(field->character);
a0 = a1;
}
}
276,7 → 281,7
keyfield_t *interbuf = NULL;
size_t intersize = 0;
 
char c;
wchar_t c;
int col, row, w, h;
int fgcolor;
int bgcolor;
343,7 → 348,7
serial_goto(row, col);
lastcol = col + 1;
lastrow = row;
(*putc_function)(c);
serial_putchar(c);
retval = 0;
break;
case FB_CURSOR_GOTO:
/trunk/uspace/srv/fb/fb.c
97,7 → 97,7
 
/** Backbuffer character cell. */
typedef struct {
uint8_t glyph;
uint32_t glyph;
uint32_t fg_color;
uint32_t bg_color;
} bb_cell_t;
194,9 → 194,9
ipcarg_t bg_color, ipcarg_t attr);
 
static void draw_glyph_aligned(unsigned int x, unsigned int y, bool cursor,
uint8_t *glyphs, uint8_t glyph, uint32_t fg_color, uint32_t bg_color);
uint8_t *glyphs, uint32_t glyph, uint32_t fg_color, uint32_t bg_color);
static void draw_glyph_fallback(unsigned int x, unsigned int y, bool cursor,
uint8_t *glyphs, uint8_t glyph, uint32_t fg_color, uint32_t bg_color);
uint8_t *glyphs, uint32_t glyph, uint32_t fg_color, uint32_t bg_color);
 
static void draw_vp_glyph(viewport_t *vport, bool cursor, unsigned int col,
unsigned int row);
659,7 → 659,7
* @param bg_color Backgroudn color.
*/
static void draw_glyph_aligned(unsigned int x, unsigned int y, bool cursor,
uint8_t *glyphs, uint8_t glyph, uint32_t fg_color, uint32_t bg_color)
uint8_t *glyphs, uint32_t glyph, uint32_t fg_color, uint32_t bg_color)
{
unsigned int i, yd;
unsigned long fg_buf, bg_buf;
667,6 → 667,10
unsigned long mask;
unsigned int ww, d_add;
 
/* Check glyph range. */
if (glyph >= FONT_GLYPHS)
return;
 
/*
* Prepare a pair of words, one filled with foreground-color
* pattern and the other filled with background-color pattern.
678,7 → 682,6
bg_color);
}
 
 
/* Pointer to the current position in the mask. */
maskp = (unsigned long *) &glyphs[GLYPH_POS(glyph, 0, cursor)];
 
720,7 → 723,7
* @param bg_color Backgroudn color.
*/
void draw_glyph_fallback(unsigned int x, unsigned int y, bool cursor,
uint8_t *glyphs, uint8_t glyph, uint32_t fg_color, uint32_t bg_color)
uint8_t *glyphs, uint32_t glyph, uint32_t fg_color, uint32_t bg_color)
{
unsigned int i, j, yd;
uint8_t fg_buf[4], bg_buf[4];
728,6 → 731,10
unsigned int d_add;
uint8_t b;
 
/* Check glyph range. */
if (glyph >= FONT_GLYPHS)
return;
 
/* Pre-render 1x the foreground and background color pixels. */
if (cursor) {
screen.rgb_conv(fg_buf, bg_color);
779,7 → 786,7
unsigned int x = vport->x + COL2X(col);
unsigned int y = vport->y + ROW2Y(row);
 
uint8_t glyph;
uint32_t glyph;
uint32_t fg_color;
uint32_t bg_color;
836,7 → 843,7
* @param row Screen position relative to viewport
*
*/
static void draw_char(viewport_t *vport, uint8_t c, unsigned int col, unsigned int row)
static void draw_char(viewport_t *vport, wchar_t c, unsigned int col, unsigned int row)
{
bb_cell_t *bbp;
 
846,7 → 853,7
cursor_hide(vport);
 
bbp = &vport->backbuf[BB_POS(vport, col, row)];
bbp->glyph = c;
bbp->glyph = (uint32_t) c;
bbp->fg_color = vport->attr.fg_color;
bbp->bg_color = vport->attr.bg_color;
 
889,7 → 896,7
unsigned int row = y + j;
 
bbp = &vport->backbuf[BB_POS(vport, col, row)];
uint8_t glyph = bbp->glyph;
uint32_t glyph = bbp->glyph;
 
a = &data[j * w + i].attrs;
rgb_from_attr(&rgb, a);
1510,7 → 1517,7
int retval;
unsigned int i;
int scroll;
uint8_t glyph;
uint32_t glyph;
unsigned int row, col;
if ((vport->cursor_active) || (anims_enabled))