Changeset 7ce3cb2 in mainline


Ignore:
Timestamp:
2009-04-02T22:04:29Z (15 years ago)
Author:
Jiri Svoboda <jirik.svoboda@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b888d5f
Parents:
58d5a7e7
Message:

Define wchar_t in userspace. Use it in fb and console.

Location:
uspace
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/libc/include/sys/types.h

    r58d5a7e7 r7ce3cb2  
    4343typedef int mode_t;
    4444
     45typedef int32_t wchar_t;
     46
    4547typedef volatile uint8_t ioport8_t;
    4648typedef volatile uint16_t ioport16_t;
  • uspace/srv/console/console.c

    r58d5a7e7 r7ce3cb2  
    104104static char cwrite_buf[CWRITE_BUF_SIZE];
    105105
    106 static void fb_putchar(char c, int row, int col);
     106static void fb_putchar(wchar_t c, int row, int col);
    107107
    108108
     
    252252
    253253/** Print a character to the active VC with buffering. */
    254 static void fb_putchar(char c, int row, int col)
     254static void fb_putchar(wchar_t c, int row, int col)
    255255{
    256256        async_msg_3(fb_info.phone, FB_PUTCHAR, c, row, col);
     
    258258
    259259/** Process a character from the client (TTY emulation). */
    260 static void write_char(int console, char key)
     260static void write_char(int console, wchar_t ch)
    261261{
    262262        bool flush_cursor = false;
    263263        screenbuffer_t *scr = &(connections[console].screenbuffer);
    264264
    265         switch (key) {
     265        switch (ch) {
    266266        case '\n':
    267267                fb_pending_flush();
     
    288288                        cell_mark_changed(scr->position_y, scr->position_x);
    289289
    290                 screenbuffer_putchar(scr, key);
     290                screenbuffer_putchar(scr, ch);
    291291                scr->position_x++;
    292292        }
  • uspace/srv/console/screenbuffer.c

    r58d5a7e7 r7ce3cb2  
    4444 * @param c     stored character
    4545 */
    46 void screenbuffer_putchar(screenbuffer_t *scr, char c)
     46void screenbuffer_putchar(screenbuffer_t *scr, wchar_t ch)
    4747{
    4848        keyfield_t *field;
    49        
     49
    5050        field = get_field_at(scr, scr->position_x, scr->position_y);
    5151
    52         field->character = c;
     52        field->character = ch;
    5353        field->attrs = scr->attrs;
    5454}
  • uspace/srv/console/screenbuffer.h

    r58d5a7e7 r7ce3cb2  
    3737
    3838#include <stdint.h>
     39#include <sys/types.h>
    3940
    4041#define DEFAULT_FOREGROUND 0x0  /**< default console foreground color */
     
    7172/** One field on screen. It contain one character and its attributes. */
    7273typedef struct {
    73         char character;                 /**< Character itself */
     74        wchar_t character;              /**< Character itself */
    7475        attrs_t attrs;                  /**< Character`s attributes */
    7576} keyfield_t;
     
    9293 * @return      keyfield structure with character and its attributes on x,y
    9394 */
    94 static inline keyfield_t *get_field_at(screenbuffer_t *scr, unsigned int x, unsigned int y) 
     95static inline keyfield_t *get_field_at(screenbuffer_t *scr, unsigned int x, unsigned int y)
    9596{
    9697        return scr->buffer + x + ((y + scr->top_line) % scr->size_y) * scr->size_x;
     
    117118
    118119
    119 void screenbuffer_putchar(screenbuffer_t *scr, char c);
     120void screenbuffer_putchar(screenbuffer_t *scr, wchar_t c);
    120121screenbuffer_t *screenbuffer_init(screenbuffer_t *scr, int size_x, int size_y);
    121122
  • uspace/srv/fb/fb.c

    r58d5a7e7 r7ce3cb2  
    9898/** Backbuffer character cell. */
    9999typedef struct {
    100         uint8_t glyph;
     100        uint32_t glyph;
    101101        uint32_t fg_color;
    102102        uint32_t bg_color;
     
    195195
    196196static void draw_glyph_aligned(unsigned int x, unsigned int y, bool cursor,
    197     uint8_t *glyphs, uint8_t glyph, uint32_t fg_color, uint32_t bg_color);
     197    uint8_t *glyphs, uint32_t glyph, uint32_t fg_color, uint32_t bg_color);
    198198static void draw_glyph_fallback(unsigned int x, unsigned int y, bool cursor,
    199     uint8_t *glyphs, uint8_t glyph, uint32_t fg_color, uint32_t bg_color);
     199    uint8_t *glyphs, uint32_t glyph, uint32_t fg_color, uint32_t bg_color);
    200200
    201201static void draw_vp_glyph(viewport_t *vport, bool cursor, unsigned int col,
     
    660660 */
    661661static void draw_glyph_aligned(unsigned int x, unsigned int y, bool cursor,
    662     uint8_t *glyphs, uint8_t glyph, uint32_t fg_color, uint32_t bg_color)
     662    uint8_t *glyphs, uint32_t glyph, uint32_t fg_color, uint32_t bg_color)
    663663{
    664664        unsigned int i, yd;
     
    667667        unsigned long mask;
    668668        unsigned int ww, d_add;
     669
     670        /* Check glyph range. */
     671        if (glyph >= FONT_GLYPHS)
     672                return;
    669673
    670674        /*
     
    679683        }
    680684
    681 
    682685        /* Pointer to the current position in the mask. */
    683686        maskp = (unsigned long *) &glyphs[GLYPH_POS(glyph, 0, cursor)];
     
    721724 */
    722725void draw_glyph_fallback(unsigned int x, unsigned int y, bool cursor,
    723     uint8_t *glyphs, uint8_t glyph, uint32_t fg_color, uint32_t bg_color)
     726    uint8_t *glyphs, uint32_t glyph, uint32_t fg_color, uint32_t bg_color)
    724727{
    725728        unsigned int i, j, yd;
     
    728731        unsigned int d_add;
    729732        uint8_t b;
     733
     734        /* Check glyph range. */
     735        if (glyph >= FONT_GLYPHS)
     736                return;
    730737
    731738        /* Pre-render 1x the foreground and background color pixels. */
     
    780787        unsigned int y = vport->y + ROW2Y(row);
    781788
    782         uint8_t glyph;
     789        uint32_t glyph;
    783790        uint32_t fg_color;
    784791        uint32_t bg_color;
     
    837844 *
    838845 */
    839 static void draw_char(viewport_t *vport, uint8_t c, unsigned int col, unsigned int row)
     846static void draw_char(viewport_t *vport, wchar_t c, unsigned int col, unsigned int row)
    840847{
    841848        bb_cell_t *bbp;
     
    847854
    848855        bbp = &vport->backbuf[BB_POS(vport, col, row)];
    849         bbp->glyph = c;
     856        bbp->glyph = (uint32_t) c;
    850857        bbp->fg_color = vport->attr.fg_color;
    851858        bbp->bg_color = vport->attr.bg_color;
     
    890897
    891898                        bbp = &vport->backbuf[BB_POS(vport, col, row)];
    892                         uint8_t glyph = bbp->glyph;
     899                        uint32_t glyph = bbp->glyph;
    893900
    894901                        a = &data[j * w + i].attrs;
     
    15111518                unsigned int i;
    15121519                int scroll;
    1513                 uint8_t glyph;
     1520                uint32_t glyph;
    15141521                unsigned int row, col;
    15151522               
  • uspace/srv/fb/serial_console.c

    r58d5a7e7 r7ce3cb2  
    103103}
    104104
     105void serial_putchar(wchar_t ch)
     106{
     107        (*putc_function)(ch);
     108}
     109
    105110void serial_goto(const unsigned int row, const unsigned int col)
    106111{
     
    257262                        if (!attrs_same(*a0, *a1))
    258263                                serial_set_attrs(a1);
    259                         (*putc_function)(field->character);
     264                        serial_putchar(field->character);
    260265                        a0 = a1;
    261266                }
     
    277282        size_t intersize = 0;
    278283
    279         char c;
     284        wchar_t c;
    280285        int col, row, w, h;
    281286        int fgcolor;
     
    344349                        lastcol = col + 1;
    345350                        lastrow = row;
    346                         (*putc_function)(c);
     351                        serial_putchar(c);
    347352                        retval = 0;
    348353                        break;
Note: See TracChangeset for help on using the changeset viewer.